diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/+layout.server.ts | 2 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/+layout.server.ts | 2 | ||||
| -rw-r--r-- | src/routes/+layout.server.ts | 2 | ||||
| -rw-r--r-- | src/routes/+layout.svelte | 7 |
4 files changed, 5 insertions, 8 deletions
diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts index 96bde919..85aa3e15 100644 --- a/src/routes/(app)/+layout.server.ts +++ b/src/routes/(app)/+layout.server.ts @@ -55,6 +55,6 @@ export async function load({ cookies, request, url, params }) { console.log(e); } - const theme = cookies.get("theme"); + const theme = cookies.get("theme") || "light"; return { user, token, rate, rates, subject, theme }; } diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts index e428d9fe..c4a4ccab 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.ts +++ b/src/routes/(app)/invoice/[id]/+layout.server.ts @@ -36,6 +36,6 @@ export async function load({ cookies, depends, params, url, parent }) { } const src = Qr.drawImg(invoice?.text || "", { size: 500 }); - const theme = cookies.get("theme"); + const theme = cookies.get("theme") || "light"; return { id, invoice, subject, src, user, token, theme }; } diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 78a4d012..7fa95931 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -37,7 +37,7 @@ export const load = async ({ cookies, request, url }) => { } await loadTranslations(locale, pathname); // keep this just before the `return` - const theme = cookies.get("theme"); + const theme = cookies.get("theme") || "light"; return { theme, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a2dc3bff..e7baa137 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,5 @@ <script> - import { run } from 'svelte/legacy'; + import { run } from "svelte/legacy"; import { browser } from "$app/environment"; import { PUBLIC_DOMAIN } from "$env/static/public"; @@ -11,15 +11,12 @@ let { data, children } = $props(); let { pathname, theme } = $state(data); $themeStore = theme; + $effect(() => (theme = $themeStore)); let host = PUBLIC_DOMAIN.includes("localhost") ? `http://${PUBLIC_DOMAIN}` : `https://${PUBLIC_DOMAIN}`; - run(() => { - theme = $themeStore - }); - onMount(() => { if (!browser) return; window.addEventListener("beforeinstallprompt", (event) => { |
