|
@@ -5,6 +5,12 @@ Vue.use(VueRouter);
|
|
|
|
|
|
// The meta.group param is used in App.vue to expand menu group by name.
|
|
|
const routes = [
|
|
|
+ {
|
|
|
+ path: '/404',
|
|
|
+ name: '404_page',
|
|
|
+ meta: { title: '404' },
|
|
|
+ component: () => import(/* webpackChunkName: "main" */ '../views/404.vue'),
|
|
|
+ },
|
|
|
{
|
|
|
path: '/',
|
|
|
name: 'dashboard',
|
|
@@ -116,6 +122,14 @@ const router = new VueRouter({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+router.beforeEach((to, from, next) => {
|
|
|
+ if (to.matched.length === 0) {
|
|
|
+ next('/404');
|
|
|
+ } else {
|
|
|
+ next();
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
router.afterEach((to) => {
|
|
|
Vue.nextTick(() => {
|
|
|
document.title = `${to.meta.title} / listmonk`;
|