mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-12 18:43:50 +00:00
Merge pull request #104 from jcreek/93-cookie-consent-compliance
feat(#93): add ability to reject cookies and in turn anayltic scripts
This commit is contained in:
@@ -9,12 +9,12 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (!cookiesAccepted) {
|
if (!cookiesAccepted) {
|
||||||
const storedValue = localStorage.getItem('cookiesAccepted');
|
const storedValue = localStorage.getItem('cookiesAccepted');
|
||||||
showBanner = storedValue !== 'true';
|
showBanner = storedValue === null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const acceptCookies = () => {
|
const handleCookiesSubmit = (accepted: boolean) => {
|
||||||
localStorage.setItem('cookiesAccepted', 'true');
|
localStorage.setItem('cookiesAccepted', accepted.toString());
|
||||||
showBanner = false;
|
showBanner = false;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -30,8 +30,11 @@
|
|||||||
>Privacy Policy</a
|
>Privacy Policy</a
|
||||||
>.
|
>.
|
||||||
</p>
|
</p>
|
||||||
<button class="bg-blue-500 hover:bg-blue-600 px-4 py-2 rounded" on:click={acceptCookies}
|
<button class="bg-blue-500 hover:bg-blue-600 px-4 py-2 rounded" on:click={() => handleCookiesSubmit(true)}
|
||||||
>Accept</button
|
>Accept</button
|
||||||
>
|
>
|
||||||
|
<button class="bg-blue-500 hover:bg-blue-600 px-4 py-2 rounded" on:click={() => handleCookiesSubmit(false)}
|
||||||
|
>Reject</button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user