aboutsummaryrefslogtreecommitdiff
path: root/src/stores/settings.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-03-03 09:10:14 -0800
committerFuwn <[email protected]>2026-03-03 09:10:18 -0800
commitb3ac58a43e5c604a460e7cfcd6100a6d644f15c6 (patch)
treeac7cdcf7f68d623eeb56d05b9f63cbfb5722ca41 /src/stores/settings.ts
parentrefactor(effect): add request body schema decoders to api routes (diff)
downloaddue.moe-b3ac58a43e5c604a460e7cfcd6100a6d644f15c6.tar.xz
due.moe-b3ac58a43e5c604a460e7cfcd6100a6d644f15c6.zip
refactor(effect): harden settings and media cache json parsing
Diffstat (limited to 'src/stores/settings.ts')
-rw-r--r--src/stores/settings.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stores/settings.ts b/src/stores/settings.ts
index e960eff6..263b7d43 100644
--- a/src/stores/settings.ts
+++ b/src/stores/settings.ts
@@ -1,4 +1,5 @@
import { browser } from "$app/environment";
+import { parseJsonStringOrDefault } from "$lib/Effect/json";
import root from "$lib/Utility/root";
import { get, writable } from "svelte/store";
import settingsSyncPulled from "./settingsSyncPulled";
@@ -144,8 +145,9 @@ const defaultSettings: Settings = {
const createStore = () => {
const initialValue = browser
- ? JSON.parse(
- localStorage.getItem("settings") || JSON.stringify(defaultSettings),
+ ? parseJsonStringOrDefault(
+ localStorage.getItem("settings") || "",
+ defaultSettings,
)
: defaultSettings;
const store = writable<Settings>(initialValue);