fix: handle refresh token error

This commit is contained in:
twwu 2024-10-12 14:29:26 +08:00
parent d8c802aa20
commit 926c4d6f2a

View File

@ -26,13 +26,18 @@ const SwrInitor = ({
router.replace('/signin')
return
}
if (consoleTokenFromLocalStorage && refreshTokenFromLocalStorage)
getNewAccessToken(consoleTokenFromLocalStorage, refreshTokenFromLocalStorage)
if (consoleTokenFromLocalStorage && refreshTokenFromLocalStorage) {
getNewAccessToken(consoleTokenFromLocalStorage, refreshTokenFromLocalStorage).catch(() => {
router.replace('/signin')
})
}
if (consoleToken && refreshToken) {
localStorage.setItem('console_token', consoleToken)
localStorage.setItem('refresh_token', refreshToken)
getNewAccessToken(consoleToken, refreshToken)
getNewAccessToken(consoleToken, refreshToken).catch(() => {
router.replace('/signin')
})
}
router.replace('/apps', { forceOptimisticNavigation: false } as any)