Auth-Redirect vor Bootstrap verhindern

This commit is contained in:
2026-06-02 12:03:34 +02:00
parent 4aea8b94c3
commit 78f9bd3f7a
2 changed files with 17 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
export default defineNuxtRouteMiddleware(async (to, from) => {
const auth = useAuthStore()
const token = useCookie<string | null>("token", { path: "/" }).value
const token = auth.getStoredToken()
// DEBUG: Was sieht die Middleware wirklich?
console.log("🔒 Middleware Check auf:", to.path)
@@ -13,7 +13,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
return
}
if (!auth.user && token && process.client) {
if (!auth.user && token) {
console.log("🔄 Auth-Bootstrap aus Cookie")
await auth.initStore()
}