Kundenportal arbeiten
This commit is contained in:
@@ -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")
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user