fix: keep token expiry in sync when skipping setUser from JWT
When the setUser call is skipped for an already-loaded user, info.value.exp was never updated with the renewed token's expiry. This caused useRenewTokenOnFocus to compute a stale expiresIn, eventually forcing a logout even though the token was still valid. Now we always update exp from the JWT, even when skipping the full setUser call.
This commit is contained in:
parent
1d420dd1dc
commit
65806df605
|
|
@ -300,6 +300,9 @@ export const useAuthStore = defineStore('auth', () => {
|
|||
// where the display name briefly reverts to the username.
|
||||
if (info.value === null || info.value.id !== jwtUser.id) {
|
||||
setUser(jwtUser, false)
|
||||
} else {
|
||||
// Always keep exp in sync so token renewal checks stay accurate
|
||||
info.value.exp = jwtUser.exp
|
||||
}
|
||||
} catch (_) {
|
||||
logout()
|
||||
|
|
|
|||
Loading…
Reference in New Issue