Skip to content

Commit

Permalink
fix: set cookie path correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
goosewobbler committed Aug 2, 2024
1 parent bf3a3aa commit e54d7b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/utils/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const cookieStorage = {
},
setItem(key, value) {
if (typeof window === 'undefined') return
document.cookie = `${key}=${value};Path=/;SameSite=Lax`
const pathBits = window.location.pathname.split('/')
const path = pathBits.slice(0, pathBits.length - 1).concat('/')
document.cookie = `${key}=${value};Path=${path};SameSite=Lax`
},
removeItem(key) {
if (typeof window === 'undefined') return
Expand Down

0 comments on commit e54d7b9

Please sign in to comment.