diff --git a/src/router/index.js b/src/router/index.js index 6a647ce..08fd1b2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -42,13 +42,18 @@ router.beforeEach((to, from) => { // ✅ This will work because the router starts its navigation after // the router is installed and pinia will be installed too const storeUser = useUserStore() - if (to.meta.requiresAuth && !storeUser.isValid) { - if (from.fullPath == '/') { + if (!from.meta.requiresAuth && to.meta.requiresAuth && !storeUser.isValid) { + //console.log('caso 1', from.name) + if (from.name) { + //console.log('1a') return false + } else { + //console.log('1b') + return '/' } - return '/' } if (to.fullPath == '/') { + //console.log('caso 2') storeUser.user = '' storeUser.isValid = false }