2026-02-25 17:33:37 -06:00
|
|
|
export default defineNuxtRouteMiddleware((to) => {
|
2026-04-05 00:36:20 -05:00
|
|
|
const publicRoutes = [
|
|
|
|
|
'auth-login',
|
|
|
|
|
'auth-register',
|
|
|
|
|
'auth-reset-password',
|
|
|
|
|
'invitations-token-accept',
|
|
|
|
|
'invitations-token-decline',
|
|
|
|
|
]
|
|
|
|
|
if (publicRoutes.includes(String(to.name))) return
|
2026-02-25 17:33:37 -06:00
|
|
|
|
|
|
|
|
const xsrfToken = useCookie('XSRF-TOKEN')
|
|
|
|
|
if (!xsrfToken.value) {
|
|
|
|
|
return navigateTo('/auth/login')
|
|
|
|
|
}
|
|
|
|
|
})
|