From e7f4aa3016ca8bf32cc3b48d87bf1c9ddef73609 Mon Sep 17 00:00:00 2001 From: Javi Pacheco Date: Mon, 11 Sep 2023 15:52:56 +0200 Subject: [PATCH] Saving token in sessions storage (#414) --- server/web/src/state/Settings/SettingsContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/web/src/state/Settings/SettingsContext.tsx b/server/web/src/state/Settings/SettingsContext.tsx index bcd34fb2b..5a759db84 100644 --- a/server/web/src/state/Settings/SettingsContext.tsx +++ b/server/web/src/state/Settings/SettingsContext.tsx @@ -16,7 +16,7 @@ export type Settings = { type SettingsContextType = [Settings, Dispatch>]; export const initialSettings: Settings = { - apiKey: undefined, + apiKey: sessionStorage.getItem('apiKey') || '', }; const SettingsContext = createContext([ @@ -29,6 +29,7 @@ const SettingsProvider = ({children}: { children: ReactNode }) => { useEffect(() => { console.info('Settings changed', {...settings}); + sessionStorage.setItem('apiKey', settings.apiKey || ''); }, [settings]); return (