feat : mise à jour de la structure du projet

This commit is contained in:
2026-04-09 11:02:19 +02:00
parent bcfecb2281
commit 68d62c31ec
69 changed files with 4782 additions and 408 deletions

View File

@@ -0,0 +1,23 @@
export default defineNuxtRouteMiddleware(async (to) => {
const auth = useAuthStore()
const isLogin = to.path === '/login'
if (!auth.checked) {
await auth.ensureSession()
}
if (!isLogin && !auth.isAuthenticated) {
return navigateTo('/login')
}
if (isLogin && auth.isAuthenticated) {
return navigateTo('/')
}
if (auth.isAuthenticated) {
const { loaded, loadSidebar } = useSidebar()
if (!loaded.value) {
await loadSidebar()
}
}
})

View File

@@ -0,0 +1,18 @@
export default defineNuxtRouteMiddleware(async (to) => {
const auth = useAuthStore()
// Don't block routes for unauthenticated users — auth middleware handles them first.
if (!auth.isAuthenticated) {
return
}
const { loaded, loadSidebar, isRouteDisabled } = useSidebar()
if (!loaded.value) {
await loadSidebar()
}
if (isRouteDisabled(to.path)) {
return navigateTo('/')
}
})