ffplayout/middleware/auth.global.ts

10 lines
195 B
TypeScript
Raw Normal View History

2023-01-11 10:54:25 +01:00
export default defineNuxtRouteMiddleware((to, from) => {
const auth = useAuth()
2023-01-11 10:54:25 +01:00
auth.inspectToken()
if (!auth.isLogin && to.path !== '/') {
return navigateTo('/')
2023-01-11 10:54:25 +01:00
}
})