rutas se mantienen en /

This commit is contained in:
2024-09-04 18:17:21 +02:00
parent efbe1d2d69
commit 0e302223e9

View File

@@ -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
}