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

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

@ -75,16 +75,18 @@ export const useAuth = () => {
validator: isString, validator: isString,
}) })
const signinRedirectCallback = useCallback(async () => { const signinRedirectCallback = useCallback(() => {
const loadedUser = await userManager.signinRedirectCallback() userManager.signinRedirectCallback()
storeUser(loadedUser) .then((loadedUser) => {
queryParamStorage.clear() storeUser(loadedUser)
history.replace(PAGES.home) queryParamStorage.clear()
markUserLoaded() history.replace(PAGES.home)
if (matchPage) { markUserLoaded()
history.push(matchPage) if (matchPage) {
setMatchPage('') history.push(matchPage)
} 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