Skip to content

Commit

Permalink
Saved Theme Preference Using LocalStorage Instead of SessionStorage
Browse files Browse the repository at this point in the history
Saved Theme Preference Using LocalStorage Instead of SessionStorage
#92
  • Loading branch information
turbokirichenko authored Dec 14, 2024
1 parent 476ae92 commit 2a49937
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function getSetting<T extends keyof Settings>(name: T): Settings[T] {
}

try {
return (sessionStorage.getItem(name) as Settings[T]) || DEFAULT_USER_SETTINGS[name];
return (localStorage.getItem(name) as Settings[T]) || DEFAULT_USER_SETTINGS[name];
} catch {
return DEFAULT_USER_SETTINGS[name];
}
Expand All @@ -125,6 +125,6 @@ export function setSetting<T>(name: string, value: T) {
}

try {
sessionStorage.setItem(name, String(value));
localStorage.setItem(name, String(value));
} catch {}
}

0 comments on commit 2a49937

Please sign in to comment.