2023-12-14 15:53:05 +00:00
|
|
|
export default defineNuxtRouteMiddleware((to, from) => {
|
|
|
|
const authStore = useAuthStore()
|
|
|
|
|
|
|
|
if (!authStore.check) {
|
|
|
|
useCookie('intended_url').value = to.path
|
|
|
|
|
2023-12-16 18:21:03 +00:00
|
|
|
console.log('redirecting to login')
|
|
|
|
return navigateTo({ name: 'login' })
|
2023-12-14 15:53:05 +00:00
|
|
|
}
|
|
|
|
})
|