2024-04-16 12:13:28 -04:00
|
|
|
export default defineNuxtRouteMiddleware((to) => {
|
2023-01-11 04:54:25 -05:00
|
|
|
const auth = useAuth()
|
2024-04-11 15:34:03 -04:00
|
|
|
const localePath = useLocalePath()
|
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
|
|
|
|
2024-04-11 15:34:03 -04:00
|
|
|
if (!auth.isLogin && !String(to.name).includes('index_')) {
|
|
|
|
return navigateTo(localePath({ name: 'index' }))
|
2023-01-11 04:54:25 -05:00
|
|
|
}
|
2023-12-02 16:00:25 -05:00
|
|
|
})
|