ffplayout/middleware/auth.global.ts

12 lines
236 B
TypeScript
Raw Normal View History

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