Skip to content

Commit

Permalink
fix(client): color scheme persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo committed Apr 21, 2023
1 parent f2a7122 commit 465ac29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/client/src/contexts/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ export function ThemeProvider({ children }: ProviderProps) {
useEffect(() => {
const cookies = parseCookies();

const colorSchemeCookie = cookies["visuldynamics-color-scheme"];
const colorSchemeCookie = cookies["visualdynamics-color-scheme"];
if (colorSchemeCookie) {
setTheme(colorSchemeCookie as Theme);
}
}, []);

function changeTheme(newTheme: Theme) {
setCookie(undefined, "visualdynamics-color-scheme", newTheme, {
path: "/"
path: "/",
maxAge: 60 * 60 * 24 * 31 * 12
});
setTheme(newTheme);
}
Expand Down

0 comments on commit 465ac29

Please sign in to comment.