mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: save access_token and refresh_token to the localStorage after login success
This commit is contained in:
parent
8c1fcc91d3
commit
c12cb2913a
|
@ -29,8 +29,11 @@ const SwrInitor = ({
|
|||
if (consoleTokenFromLocalStorage && refreshTokenFromLocalStorage)
|
||||
getNewAccessToken(consoleTokenFromLocalStorage, refreshTokenFromLocalStorage)
|
||||
|
||||
if (consoleToken && refreshToken)
|
||||
if (consoleToken && refreshToken) {
|
||||
localStorage.setItem('console_token', consoleToken)
|
||||
localStorage.setItem('refresh_token', refreshToken)
|
||||
getNewAccessToken(consoleToken, refreshToken)
|
||||
}
|
||||
|
||||
router.replace('/apps', { forceOptimisticNavigation: false } as any)
|
||||
setInit(true)
|
||||
|
|
|
@ -97,6 +97,8 @@ const NormalForm = () => {
|
|||
},
|
||||
})
|
||||
if (res.result === 'success') {
|
||||
localStorage.setItem('console_token', res.data.access_token)
|
||||
localStorage.setItem('refresh_token', res.data.refresh_token)
|
||||
getNewAccessToken(res.data.access_token, res.data.refresh_token)
|
||||
router.replace('/apps')
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ const UserSSOForm: FC<UserSSOFormProps> = ({
|
|||
|
||||
useEffect(() => {
|
||||
if (refreshToken && consoleToken) {
|
||||
localStorage.setItem('console_token', consoleToken)
|
||||
localStorage.setItem('refresh_token', refreshToken)
|
||||
getNewAccessToken(consoleToken, refreshToken)
|
||||
router.replace('/apps')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user