diff --git a/frontend/middleware/auth.global.ts b/frontend/middleware/auth.global.ts index 305e110..9ac7781 100644 --- a/frontend/middleware/auth.global.ts +++ b/frontend/middleware/auth.global.ts @@ -1,6 +1,5 @@ export default defineNuxtRouteMiddleware(async (to, from) => { const auth = useAuthStore() - const token = auth.getStoredToken() // DEBUG: Was sieht die Middleware wirklich? console.log("🔒 Middleware Check auf:", to.path) @@ -13,6 +12,12 @@ export default defineNuxtRouteMiddleware(async (to, from) => { return } + if (process.server) { + return + } + + const token = auth.getStoredToken() + if (!auth.user && token) { console.log("🔄 Auth-Bootstrap aus Cookie") await auth.initStore()