Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Fix routing verification

zdmd12b14816b5a
diff --git a/core/frontend/src/router/index.ts b/core/frontend/src/router/index.ts
index 54f9efd1..2319020e 100644
--- a/core/frontend/src/router/index.ts
+++ b/core/frontend/src/router/index.ts
@@ -11,6 +11,7 @@ router.beforeEach(async (to, from, next) => {
// Check if the visited route exists in the registered routes
const routeExists = routes.some(route => route.path === to.path)
+
// If the route does not exist, go directly
if (!routeExists) {
next()
diff --git a/core/frontend/src/router/modules/overview.ts b/core/frontend/src/router/modules/overview.ts
new file mode 100644
index 00000000..512a9b4f
--- /dev/null
+++ b/core/frontend/src/router/modules/overview.ts
@@ -0,0 +1,17 @@
+import { RouteRecordRaw } from 'vue-router'
+import { Layout } from '@/router/constant'
+
+const route: RouteRecordRaw = {
+ path: '/overview',
+ component: Layout,
+ meta: { sort: 0, key: 'overview', title: 'Overview' },
+ children: [
+ {
+ path: '/overview',
+ name: 'Overview',
+ component: () => import('@/views/overview/index.vue'),
+ },
+ ],
+}
+
+export default route
diff --git a/core/frontend/src/router/router.ts b/core/frontend/src/router/router.ts
index 4b3b161f..34e6bf4f 100644
--- a/core/frontend/src/router/router.ts
+++ b/core/frontend/src/router/router.ts
@@ -1,7 +1,6 @@
import { get } from 'lodash-es'
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import { is } from '@/utils'
-import { Layout } from '@/router/constant'
// Import routes from modules
const modules = import.meta.webpackContext('./modules', {
@@ -28,32 +27,16 @@ menuList.sort((a, b) => {
return aSort - bSort
})
-const dashboardRouter: RouteRecordRaw = {
- path: '/',
- component: Layout,
- redirect: '/overview',
- meta: {
- key: 'overview',
- title: 'Overview',
- hidden: false,
- },
- children: [
- {
- path: 'overview',
- name: 'Overview',
- component: () => import('@/views/overview/index.vue'),
- },
- ],
-}
-
-menuList.unshift(dashboardRouter)
-
export const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue'),
},
+ {
+ path: '/',
+ redirect: '/overview',
+ },
...menuList,
]