ffplayout/frontend/middleware/auth.global.ts
2024-09-24 10:49:37 +02:00

11 lines
273 B
TypeScript

export default defineNuxtRouteMiddleware((to) => {
const auth = useAuth()
const localePath = useLocalePath()
auth.inspectToken()
if (!auth.isLogin && !String(to.name).includes('index_')) {
return navigateTo(localePath({ name: 'index' }))
}
})