Skip to content

Commit

Permalink
fix: add null check for initial login session
Browse files Browse the repository at this point in the history
  • Loading branch information
psanders committed Nov 25, 2023
1 parent 43eb77a commit 4b71d81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mods/frontoffice/src/authentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export function AuthProvider({ children }: AuthProviderProps) {
};

const isAdmin = (workspaceId: string) => {
if (!client) {
return;
}

const payload = jwtDecode(client?.getToken() as string) as {
workspaces: { id: string; role: Role }[];
};
Expand All @@ -134,6 +138,10 @@ export function AuthProvider({ children }: AuthProviderProps) {
};

useEffect(() => {
if (!client) {
return;
}

const tokenExpiration = jwtDecode(client?.getToken() as string) as {
exp: number;
};
Expand Down

0 comments on commit 4b71d81

Please sign in to comment.