Skip to content

Commit

Permalink
Store docs preferences in localStorage instead (#1311)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeppahBaws committed Jul 1, 2024
1 parent cf2a102 commit 564c063
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions site/src/components/Toolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
{ label: 'dark', icon: 'sun' }
]
const COOKIE_TIMEOUT = 60 * 60 * 24 * 365 // One year
function setLang() {
document.cookie = `lang=${other_lang};path=/;SameSite=Lax`
document.cookie = `lang=${other_lang};path=/;SameSite=Lax;max-age=${COOKIE_TIMEOUT}`
lang = other_lang
}
function setTheme() {
ui_theme = ui_theme ? 0 : 1
document.cookie = `ui_theme=${ui_theme};path=/;SameSite=Lax`
document.cookie = `ui_theme=${ui_theme};path=/;SameSite=Lax;max-age=${COOKIE_TIMEOUT}`
}
</script>

Expand Down

0 comments on commit 564c063

Please sign in to comment.