diff options
| author | Adam Soltys <[email protected]> | 2025-03-06 16:12:20 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-03-06 16:12:41 -0800 |
| commit | 44e5d718e7950dc59c92ce16ea52cc79d19322f6 (patch) | |
| tree | 4c1f2a09fd43375e903aacd7949fcdcf31a4f184 /src/routes/+layout.ts | |
| parent | 6f59a0db6c82d758411b07b889dadb95f99e0349 (diff) | |
| download | coinos-ui-44e5d718e7950dc59c92ce16ea52cc79d19322f6.tar.gz coinos-ui-44e5d718e7950dc59c92ce16ea52cc79d19322f6.zip | |
remember last pathname for start page
Diffstat (limited to 'src/routes/+layout.ts')
| -rw-r--r-- | src/routes/+layout.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 79a89d47..af4a6a5c 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -5,6 +5,9 @@ import { addIcon } from "iconify-icon"; import cookies from "js-cookie"; export const ssr = false; +const expires = new Date(); +expires.setSeconds(expires.getSeconds() + 21000000); +const opts = { path: "/", expires }; /** @type {import('@sveltejs/kit').Load} */ export const load = async ({ data }) => { @@ -24,10 +27,8 @@ export const load = async ({ data }) => { ? "dark" : "light"; - const expires = new Date(); - expires.setSeconds(expires.getSeconds() + 21000000); + cookies.set("theme", theme, opts); - cookies.set("theme", theme, { path: "/", expires }); if (theme === "dark") setTimeout(() => themeStore.set(theme), 100); } } |
