mirror of
https://github.com/thelounge/thelounge
synced 2024-11-10 06:34:21 +00:00
router: don't use next() in router guards
Vue wants to get rid of the next call. https://router.vuejs.org/guide/advanced/navigation-guards.html#Optional-third-argument-next For one of the router guards, it's easy enough to do so let's do that.
This commit is contained in:
parent
9f05a75c39
commit
03795a2718
1 changed files with 5 additions and 8 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue