12 lines
236 B
TypeScript
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('/')
|
|
}
|
|
})
|