Move the navigation guard at Router level to prevent late redirects

This commit is contained in:
Bubka 2023-08-04 10:00:59 +02:00
parent f5258d7aaf
commit d00093a85a
2 changed files with 4 additions and 8 deletions

View File

@ -85,6 +85,10 @@ router.beforeEach((to, from, 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()
});

View File

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