Merge pull request #4783 from thelounge/router-api

router: don't use next() in router guards
This commit is contained in:
Max Leiter 2023-12-26 16:49:37 -08:00 committed by GitHub
commit 083abae750
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,26 +110,23 @@ router.beforeEach((to, from, next) => {
next();
});
router.beforeEach((to, from, next) => {
router.beforeEach((to, from) => {
// Disallow navigating to non-existing routes
if (!to.matched.length) {
next(false);
return;
return false;
}
// Disallow navigating to invalid channels
if (to.name === "RoutedChat" && !store.getters.findChannel(Number(to.params.id))) {
next(false);
return;
return false;
}
// Disallow navigating to invalid networks
if (to.name === "NetworkEdit" && !store.getters.findNetwork(String(to.params.uuid))) {
next(false);
return;
return false;
}
next();
return true;
});
router.afterEach((to) => {