Kundenportal arbeiten

This commit is contained in:
2026-04-08 18:52:04 +02:00
parent d9e5df07bf
commit f125617af0
9 changed files with 1017 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
export default defineNuxtRouteMiddleware(async (to, from) => {
const auth = useAuthStore()
const isPortalUser = Boolean(auth.profile?.customer_for_portal)
// DEBUG: Was sieht die Middleware wirklich?
console.log("🔒 Middleware Check auf:", to.path)
@@ -33,10 +34,14 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
if (auth.user.must_change_password) {
return navigateTo("/password-change")
}
return navigateTo("/")
return navigateTo(isPortalUser ? "/customer-portal" : "/")
}
if (auth.user.must_change_password && to.path !== "/password-change") {
return navigateTo("/password-change")
}
})
if (isPortalUser && !["/customer-portal", "/password-change"].includes(to.path)) {
return navigateTo("/customer-portal")
}
})