mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-19 19:28:08 +02:00
Move the navigation guard at Router level to prevent late redirects
This commit is contained in:
parent
f5258d7aaf
commit
d00093a85a
4
resources/js/routes.js
vendored
4
resources/js/routes.js
vendored
@ -85,6 +85,10 @@ router.beforeEach((to, from, next) => {
|
|||||||
}
|
}
|
||||||
else next()
|
else next()
|
||||||
}
|
}
|
||||||
|
else if (to.name === 'genericError' && to.params.err == undefined) {
|
||||||
|
// return to home if no err object is provided to prevent an empty error message
|
||||||
|
next({ name: 'accounts' });
|
||||||
|
}
|
||||||
else next()
|
else next()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -88,14 +88,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeRouteEnter (to, from, next) {
|
|
||||||
// return to home if no err is provided to prevent an empty error message
|
|
||||||
if (to.params.err == undefined) {
|
|
||||||
next({ name: 'accounts' });
|
|
||||||
}
|
|
||||||
else next()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user