mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-11 17:48:44 -05:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user