opnform/client/middleware/auth.js

9 lines
213 B
JavaScript

export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore()
if (!authStore.check) {
useCookie('intended_url').value = to.path
return navigateTo({ name: 'login' })
}
})