feat : add role guest
Auto Tag Develop / tag (push) Has been cancelled

This commit is contained in:
Lethary
2026-05-05 15:51:58 +02:00
parent 1c0cdeb085
commit fa1f0ccaa4
15 changed files with 72 additions and 21 deletions
+11
View File
@@ -2,6 +2,13 @@ import { useAuthStore } from '~/stores/auth'
export default defineNuxtRouteMiddleware(async (to) => {
const auth = useAuthStore()
const guestAllowedPaths = [
'/',
'/reception/waiting-reception',
'/reception/finish-reception',
'/shipment/waiting-shipment',
'/shipment/finish-shipment'
]
if (to.path === '/login') {
return
@@ -14,4 +21,8 @@ export default defineNuxtRouteMiddleware(async (to) => {
if (!auth.isAuthenticated) {
return navigateTo('/login')
}
if (auth.isGuest && !guestAllowedPaths.includes(to.path)) {
return navigateTo('/')
}
})