From 61b63944c582c3050a98385e0f22363ed2047ac1 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 19 Sep 2021 16:03:15 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Store=20userData=20in=20localStorag?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/LoginContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/LoginContext.tsx b/frontend/src/components/LoginContext.tsx index 802105b..1eaeb9d 100644 --- a/frontend/src/components/LoginContext.tsx +++ b/frontend/src/components/LoginContext.tsx @@ -4,6 +4,7 @@ import {useInstance, useInstanceAxios} from "./InstanceContext"; import {useNotNullContext} from "../hooks/useNotNullContext"; import {Validity} from "@steffo/bluelib-react/dist/types"; import {useFormState} from "@steffo/bluelib-react"; +import {useStorageState} from "../hooks/useStorageState"; export interface UserData { @@ -32,7 +33,7 @@ interface LoginContextProps { export function LoginContextProvider({children}: LoginContextProps): JSX.Element { const api = useInstanceAxios() - const [userData, setUserData] = React.useState(null) + const [userData, setUserData] = useStorageState(localStorage, "userData", null) const [running, setRunning] = React.useState(false) const login = React.useCallback(