diff --git a/js/routes/cookies.js b/js/routes/cookies.js index 5a78da0..3f55454 100644 --- a/js/routes/cookies.js +++ b/js/routes/cookies.js @@ -1,14 +1,20 @@ -// Stored in /js/routes/cookies.js +// /js/routes/cookies.js export default (hostComponent) => { - // Clear any existing content in the hostComponent - hostComponent.innerHTML = ''; + // If user has already set preferences, don't show the modal again. + if ( + localStorage.getItem('analytics-cookies') !== null && + localStorage.getItem('personalization-cookies') !== null && + localStorage.getItem('advertisement-cookies') !== null + ) { + return; + } const analyticsPreference = localStorage.getItem('analytics-cookies') === 'true'; const personalizationPreference = localStorage.getItem('personalization-cookies') === 'true'; const advertisementPreference = localStorage.getItem('advertisement-cookies') === 'true'; - // Cookie Modal Styles & HTML + // CSS for the modal const cookieModalStyles = ` `; - // Insert this style string in the component logic where the styles are concatenated. - + // HTML for the modal const cookieModalHTML = ` -