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