From 68684395a080a834d823b39e2e9641372bbafbfd Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 2 Mar 2026 23:37:57 -0800 Subject: dependency audit --- src/routes/+layout.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/routes/+layout.ts') 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); } -- cgit v1.2.3