Skip to content

Commit

Permalink
fix: ensure path and max-age are set
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Nov 22, 2023
1 parent 56d6f96 commit 39ef16d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/color-scheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function subscribeToSchemeChange(
const schemaMatch = window.matchMedia('(prefers-color-scheme: dark)')
function handleThemeChange() {
const value = schemaMatch.matches ? 'dark' : 'light'
document.cookie = `${cookieName}=${value}`
document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`
subscriber(value)
}
schemaMatch.addEventListener('change', handleThemeChange)
Expand Down
2 changes: 1 addition & 1 deletion src/reduced-motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function subscribeToMotionChange(
const motionMatch = window.matchMedia('(prefers-reduced-motion: reduce)')
function handleThemeChange() {
const value = motionMatch.matches ? 'reduce' : 'no-preference'
document.cookie = `${cookieName}=${value}`
document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`
subscriber(value)
}
motionMatch.addEventListener('change', handleThemeChange)
Expand Down

0 comments on commit 39ef16d

Please sign in to comment.