feat(front) : load sidebar/modules after login and redirect disabled routes

This commit is contained in:
Matthieu
2026-06-19 15:28:16 +02:00
parent fcfb16fc5b
commit a620833550
2 changed files with 29 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
export default defineNuxtRouteMiddleware(async (to) => {
const auth = useAuthStore()
if (!auth.isAuthenticated) {
return
}
const { loaded, loadSidebar, isRouteDisabled } = useSidebar()
if (!loaded.value) {
await loadSidebar()
}
if (isRouteDisabled(to.path)) {
return navigateTo('/')
}
})