From a60ce90f88b5c1be99a738cd7e50fe576138db58 Mon Sep 17 00:00:00 2001 From: Espen Boman Fosseide <espenbfo@stud.ntnu.no> Date: Sat, 2 Oct 2021 23:48:48 +0200 Subject: [PATCH] fix: simplify settingspage --- src/pages/SettingsPage/index.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/SettingsPage/index.tsx b/src/pages/SettingsPage/index.tsx index 181c5d4..441c726 100644 --- a/src/pages/SettingsPage/index.tsx +++ b/src/pages/SettingsPage/index.tsx @@ -14,12 +14,9 @@ type SettingsPageProps = { export default function SettingsPage(props: SettingsPageProps) { function changeTheme(event: ChangeEvent<HTMLInputElement>, value: string) { - localStorage.setItem('theme', value); - if (Object.prototype.hasOwnProperty.call(themes, value)) { - const theme = value as keyof typeof themes; - props.setTheme(themes[theme]); - props.setThemeName(theme); - } + const theme = value as keyof typeof themes; + props.setTheme(themes[theme]); + props.setThemeName(theme); } return ( <Popup title="Settings" open={props.open} onClose={props.onClose} maxWidth="sm"> -- GitLab