3.0.0 #220

Merged
flfeders merged 676 commits from dev into main 2026-09-20 16:10:48 +00:00
2 changed files with 15 additions and 2 deletions
Showing only changes of commit e9504e21e7 - Show all commits

View File

@@ -8,7 +8,8 @@ export default defineNuxtPlugin(() => {
credentials: "include",
async onRequest({ options }) {
const token = useCookie<string | null>("token", { path: "/" }).value
const auth = useAuthStore()
const token = auth.getStoredToken()
// Falls im Request explizit ein anderer JWT übergeben wird
if (options.context?.jwt) {

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