Token für Reload zusätzlich lokal sichern

This commit is contained in:
2026-06-02 12:14:16 +02:00
parent 822dcdcfb9
commit e9504e21e7
2 changed files with 15 additions and 2 deletions

View File

@@ -43,7 +43,11 @@ export const useAuthStore = defineStore("auth", {
.map((part) => part.trim())
.find((part) => part.startsWith("token="))
return tokenCookie ? decodeURIComponent(tokenCookie.slice("token=".length)) : null
if (tokenCookie) {
return decodeURIComponent(tokenCookie.slice("token=".length))
}
return localStorage.getItem("token")
},
clearScopedTokenCookies() {
@@ -164,6 +168,14 @@ export const useAuthStore = defineStore("auth", {
this.clearScopedTokenCookies()
this.tokenCookie().value = token
if (process.client) {
if (token) {
localStorage.setItem("token", token)
} else {
localStorage.removeItem("token")
}
}
if (!token) {
this.clearSessionTimers()
this.sessionWarningVisible = false