ffplayout/middleware/auth.global.ts
2024-04-16 18:13:28 +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' }))
}
})