ffplayout/middleware/auth.global.ts

11 lines
279 B
TypeScript
Raw Normal View History

2023-01-11 10:54:25 +01:00
export default defineNuxtRouteMiddleware((to, from) => {
const auth = useAuth()
2024-04-11 21:34:03 +02:00
const localePath = useLocalePath()
2023-01-11 10:54:25 +01:00
auth.inspectToken()
2024-04-11 21:34:03 +02:00
if (!auth.isLogin && !String(to.name).includes('index_')) {
return navigateTo(localePath({ name: 'index' }))
2023-01-11 10:54:25 +01:00
}
})