We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db92e12 commit 9c1d4e5Copy full SHA for 9c1d4e5
src/components/d-user/DUser.session.hook.tsx
@@ -2,11 +2,12 @@ import React from "react";
2
import type {UserSession} from "@code0-tech/sagittarius-graphql-types";
3
4
export const useUserSession = () => {
5
- const [session, setSession] = React.useState<UserSession | null>(null)
+ const [session, setSession] = React.useState<UserSession | undefined | null>(undefined)
6
7
React.useEffect(() => {
8
const userSession = JSON.parse(localStorage.getItem("ide_code-zero_session")!!) as UserSession
9
if (userSession && userSession.token) setSession(userSession)
10
+ else setSession(null)
11
}, [])
12
13
return session
0 commit comments