rutas se mantienen en /
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user