π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
:sparkles: Redirects not-found pages to the 404 route
Alicia Sykes0e31e9ab4fc1
diff --git a/src/router.js b/src/router.jsindex a1bdd95b..e76efe42 100644--- a/src/router.js+++ b/src/router.js@@ -9,17 +9,17 @@ import Vue from 'vue';import Router from 'vue-router';import ProgressBar from 'rsup-progress';-// Import views+// Import views, that are not lazy-loadedimport Home from '@/views/Home.vue';import Login from '@/views/Login.vue';import Workspace from '@/views/Workspace.vue';import Minimal from '@/views/Minimal.vue';-import DownloadConfig from '@/views/DownloadConfig.vue';// Import helper functions, config data and defaultsimport { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth';import { config } from '@/utils/ConfigHelpers';import { metaTagData, startingView, routePaths } from '@/utils/defaults';+import ErrorHandler from '@/utils/ErrorHandler';Vue.use(Router);const progress = new ProgressBar({ color: 'var(--progress-bar)' });@@ -102,16 +102,32 @@ const router = new Router({{ // The about app pagepath: routePaths.about,name: 'about', // We lazy load the About page so as to not slow down the app- component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),+ component: () => import('./views/About.vue'),meta: makeMetaTags('About Dashy'),},{ // The export config pagepath: routePaths.download,name: 'download',- component: DownloadConfig,+ component: () => import('./views/DownloadConfig.vue'),props: config,meta: makeMetaTags('Download Config'),},+ { // Page not found, any non-defined routes will land here+ path: routePaths.notFound,+ name: '404',+ component: () => import('./views/404.vue'),+ meta: makeMetaTags('404 Not Found'),+ beforeEnter: (to, from, next) => {+ if (to.redirectedFrom) { // Log error, if redirected here from another route+ ErrorHandler(`Route not found: '${to.redirectedFrom}'`);+ }+ next();+ },+ },+ { // Redirect any not-found routed to the 404 view+ path: '*',+ redirect: '/404',+ },],});