-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.vue
39 lines (33 loc) · 883 Bytes
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script setup>
import CookieConsentModal from './components/modals/CookieConsentModal.vue';
import { getCookie } from './helpers/get-cookie';
const documentDOM = ref(null);
const checkACookieExists = ref(null);
const showCookieModal = ref(false);
const handleCookieModal = function () {
showCookieModal.value = false;
};
onMounted(async () => {
documentDOM.value = window.document;
// cookie # start
checkACookieExists.value = getCookie(documentDOM, 'cookieConsent');
await nextTick(() => {
if (checkACookieExists.value) {
showCookieModal.value = false;
} else {
showCookieModal.value = true;
}
});
});
</script>
<template>
<div>
<NuxtLayout>
<NuxtPage />
<CookieConsentModal
:show="showCookieModal"
@handleCookieModal="handleCookieModal"
></CookieConsentModal>
</NuxtLayout>
</div>
</template>