ffplayout/middleware/auth.global.ts
2024-04-11 21:34:03 +02:00

11 lines
279 B
TypeScript

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