diff --git a/src/features/AuthStore/hooks/useAuth.tsx b/src/features/AuthStore/hooks/useAuth.tsx index 3ba473fb..db7793df 100644 --- a/src/features/AuthStore/hooks/useAuth.tsx +++ b/src/features/AuthStore/hooks/useAuth.tsx @@ -75,16 +75,18 @@ export const useAuth = () => { validator: isString, }) - const signinRedirectCallback = useCallback(async () => { - const loadedUser = await userManager.signinRedirectCallback() - storeUser(loadedUser) - queryParamStorage.clear() - history.replace(PAGES.home) - markUserLoaded() - if (matchPage) { - history.push(matchPage) - setMatchPage('') - } + const signinRedirectCallback = useCallback(() => { + userManager.signinRedirectCallback() + .then((loadedUser) => { + storeUser(loadedUser) + queryParamStorage.clear() + history.replace(PAGES.home) + markUserLoaded() + if (matchPage) { + history.push(matchPage) + setMatchPage('') + } + }).catch(login) }, [ userManager, history, @@ -92,6 +94,7 @@ export const useAuth = () => { storeUser, markUserLoaded, matchPage, + login, ]) useEffect(() => {