fix(1587): redirect to auth provider on callback error (#506)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 4 years ago
parent 866aacb6db
commit 39917b4e2a
  1. 7
      src/features/AuthStore/hooks/useAuth.tsx

@ -75,8 +75,9 @@ export const useAuth = () => {
validator: isString, validator: isString,
}) })
const signinRedirectCallback = useCallback(async () => { const signinRedirectCallback = useCallback(() => {
const loadedUser = await userManager.signinRedirectCallback() userManager.signinRedirectCallback()
.then((loadedUser) => {
storeUser(loadedUser) storeUser(loadedUser)
queryParamStorage.clear() queryParamStorage.clear()
history.replace(PAGES.home) history.replace(PAGES.home)
@ -85,6 +86,7 @@ export const useAuth = () => {
history.push(matchPage) history.push(matchPage)
setMatchPage('') setMatchPage('')
} }
}).catch(login)
}, [ }, [
userManager, userManager,
history, history,
@ -92,6 +94,7 @@ export const useAuth = () => {
storeUser, storeUser,
markUserLoaded, markUserLoaded,
matchPage, matchPage,
login,
]) ])
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save