diff options
| author | Adam Soltys <[email protected]> | 2026-03-02 23:37:57 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-02 23:37:57 -0800 |
| commit | 68684395a080a834d823b39e2e9641372bbafbfd (patch) | |
| tree | d9a02ed31ef3be0fe7c274b08597271e7dac8f15 /src/routes/+layout.ts | |
| parent | 97fffca3e63e2edb4818305abdbcbb8953344aa3 (diff) | |
| download | coinos-ui-68684395a080a834d823b39e2e9641372bbafbfd.tar.gz coinos-ui-68684395a080a834d823b39e2e9641372bbafbfd.zip | |
dependency audit
Diffstat (limited to 'src/routes/+layout.ts')
| -rw-r--r-- | src/routes/+layout.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 719e35d6..0fcf5ec8 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,11 +1,7 @@ import { browser } from "$app/environment"; import { theme as themeStore } from "$lib/store"; import { addTranslations, setLocale, setRoute } from "$lib/translations/index"; -import cookies from "js-cookie"; - -const expires = new Date(); -expires.setSeconds(expires.getSeconds() + 21000000); -const opts = { path: "/", expires }; +import { getCookie, setCookie } from "$lib/utils"; /** @type {import('@sveltejs/kit').Load} */ export const load = async ({ data }) => { @@ -18,12 +14,12 @@ export const load = async ({ data }) => { await setLocale(locale); if (browser) { - let theme = cookies.get("theme"); + let theme = getCookie("theme"); if (!theme) { theme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; - cookies.set("theme", theme, opts); + setCookie("theme", theme, 21000000); if (theme === "dark") setTimeout(() => themeStore.set(theme), 100); } |
