ffplayout/middleware/auth.global.ts
2023-12-02 22:00:25 +01:00

12 lines
236 B
TypeScript

import { useAuth } from '~/stores/auth'
export default defineNuxtRouteMiddleware((to, from) => {
const auth = useAuth()
auth.inspectToken()
if (!auth.isLogin && to.path !== '/') {
return navigateTo('/')
}
})