Update route paths in router index.ts
This commit is contained in:
		@@ -452,11 +452,11 @@ export const routes: RouteRecordRaw[] = [
 | 
			
		||||
            ],
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
            path: 'lap',
 | 
			
		||||
            path: 'laporan-kpi',
 | 
			
		||||
            name: 'Laporan KPI',
 | 
			
		||||
            children: [
 | 
			
		||||
              {
 | 
			
		||||
                path: 'bul',
 | 
			
		||||
                path: 'bulanan',
 | 
			
		||||
                name: 'Bulanan',
 | 
			
		||||
                children: [
 | 
			
		||||
                  {
 | 
			
		||||
@@ -518,9 +518,13 @@ export const routes: RouteRecordRaw[] = [
 | 
			
		||||
              {
 | 
			
		||||
                path: ':pathMatch(.*)*',
 | 
			
		||||
                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
 | 
			
		||||
  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(),
 | 
			
		||||
  linkActiveClass: 'active',
 | 
			
		||||
  stringifyQuery: qs.stringify,
 | 
			
		||||
  routes: fixRoute(routes)
 | 
			
		||||
  routes: fixRoute(routes),
 | 
			
		||||
  strict: true,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
router.beforeEach((to, from, next) => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user