From 0e302223e93f5b3cc062e3cc9e4955246e53dc42 Mon Sep 17 00:00:00 2001 From: Clonbg Date: Wed, 4 Sep 2024 18:17:21 +0200 Subject: [PATCH] rutas se mantienen en / --- src/router/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 }