Skip to content

Commit 1b177b9

Browse files
authored
fix: apply cookie to root path, not subpath (#320)
1 parent a1aaf0c commit 1b177b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/plugin.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default defineNuxtPlugin((nuxtApp) => {
7878
function setPreferenceToStorage(storageType: typeof storage, preference: string) {
7979
switch (storageType) {
8080
case 'cookie':
81-
window.document.cookie = storageKey + '=' + preference
81+
window.document.cookie = `${storageKey}=${preference}; max-age=${60 * 60 * 24 * 365}; path=/`
8282
break
8383
case 'sessionStorage':
8484
window.sessionStorage?.setItem(storageKey, preference)

0 commit comments

Comments
 (0)