opnform/client/middleware/auth.js

9 lines
213 B
JavaScript
Raw Normal View History

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
return navigateTo({ name: 'login' })
2023-12-14 15:53:05 +00:00
}
})