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