From 8753e7c38ce7067744b62b00a20636b723a429c6 Mon Sep 17 00:00:00 2001 From: shayan khaleghparast Date: Mon, 30 Sep 2024 14:23:33 +0800 Subject: [PATCH] chore: added fallback to accountList inside auth-context --- src/context/auth-context.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/context/auth-context.tsx b/src/context/auth-context.tsx index b6d0ef0..20f9be8 100644 --- a/src/context/auth-context.tsx +++ b/src/context/auth-context.tsx @@ -29,7 +29,9 @@ export const AuthDataProvider = ({ children }: AuthDataProviderProps) => { const { mutateAsync: requestLogout } = useLogout(); - const accountsList: Record = JSON.parse(localStorage.getItem('client.accounts') ?? '{}'); + const accountsList: Record = JSON.parse( + localStorage.getItem('client.accounts') ?? localStorage.getItem('accountsList') ?? '{}' + ); const isAuthorized = useMemo( () => isSuccess && (!!activeLoginid || !!Object.keys(accountsList).length),