Disallow navigating to non-existing routes
This commit is contained in:
parent
d232ef1557
commit
5c0a7722a4
@ -34,6 +34,12 @@ const router = new VueRouter({
|
||||
});
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// Disallow navigating to non-existing routes
|
||||
if (!to.matched.length) {
|
||||
next(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle closing image viewer with the browser back button
|
||||
if (!router.app.$refs.app) {
|
||||
next();
|
||||
|
Loading…
Reference in New Issue
Block a user