mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 06:35:10 +00:00
19 lines
363 B
TypeScript
19 lines
363 B
TypeScript
|
export function useCookieManager () {
|
||
|
const theCookie = useCookie<null | string>('theCookie', {
|
||
|
default: () => 'show',
|
||
|
})
|
||
|
|
||
|
const showCookieBanner = computed(() => {
|
||
|
return theCookie.value === 'show'
|
||
|
})
|
||
|
|
||
|
function toggle () {
|
||
|
theCookie.value = theCookie.value === 'show' ? null : 'show'
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
showCookieBanner,
|
||
|
toggle,
|
||
|
}
|
||
|
}
|