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