Update route paths in router index.ts

This commit is contained in:
Dede Fuji Abdul
2023-11-02 13:34:51 +07:00
parent 0d1c580156
commit 94d357f8bd

View File

@ -452,11 +452,11 @@ export const routes: RouteRecordRaw[] = [
], ],
}, },
{ {
path: 'lap', path: 'laporan-kpi',
name: 'Laporan KPI', name: 'Laporan KPI',
children: [ children: [
{ {
path: 'bul', path: 'bulanan',
name: 'Bulanan', name: 'Bulanan',
children: [ children: [
{ {
@ -518,9 +518,13 @@ export const routes: RouteRecordRaw[] = [
{ {
path: ':pathMatch(.*)*', path: ':pathMatch(.*)*',
component: EmptyPage, component: EmptyPage,
} },
], ],
}, },
{
path: ':pathMatch(.*)*',
component: EmptyPage,
},
], ],
}, },
{ {
@ -790,8 +794,10 @@ export const fixRoute = (route: RouteRecordRaw[]): RouteRecordRaw[] => {
// remove duplicate route path and sort by path length // remove duplicate route path and sort by path length
const uniqueRoute = newRoute.filter((nr, index, self) => self.findIndex((n) => n.path === nr.path) === index).sort((a, b) => b.path.length - a.path.length) const uniqueRoute = newRoute.filter((nr, index, self) => self.findIndex((n) => n.path === nr.path) === index).sort((a, b) => b.path.length - a.path.length)
// console.log('route', newRoute);
return uniqueRoute // return uniqueRoute
return newRoute
} }
@ -799,7 +805,8 @@ const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
linkActiveClass: 'active', linkActiveClass: 'active',
stringifyQuery: qs.stringify, stringifyQuery: qs.stringify,
routes: fixRoute(routes) routes: fixRoute(routes),
strict: true,
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {