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,
})
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(() => {

Loading…
Cancel
Save