1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

Store userData in localStorage

This commit is contained in:
Steffo 2021-09-19 16:03:15 +02:00
parent 53d5d6d47b
commit 61b63944c5

View file

@ -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<UserData | null>(null)
const [userData, setUserData] = useStorageState<UserData | null>(localStorage, "userData", null)
const [running, setRunning] = React.useState<boolean>(false)
const login = React.useCallback(