Skip to content

Commit

Permalink
refactor(projects): new route guard
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Mar 24, 2024
1 parent c11d56d commit 37d20b8
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 214 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VITE_ICON_PREFIX=icon
VITE_ICON_LOCAL_PREFIX=icon-local

# auth route mode: static | dynamic
VITE_AUTH_ROUTE_MODE=dynamic
VITE_AUTH_ROUTE_MODE=static

# static auth route home
VITE_ROUTE_HOME=home
Expand Down
12 changes: 8 additions & 4 deletions src/router/elegant/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const generatedRoutes: GeneratedRoute[] = [
meta: {
title: '403',
i18nKey: 'route.403',
constant: true
constant: true,
hideInMenu: true
}
},
{
Expand All @@ -23,7 +24,8 @@ export const generatedRoutes: GeneratedRoute[] = [
meta: {
title: '404',
i18nKey: 'route.404',
constant: true
constant: true,
hideInMenu: true
}
},
{
Expand All @@ -33,7 +35,8 @@ export const generatedRoutes: GeneratedRoute[] = [
meta: {
title: '500',
i18nKey: 'route.500',
constant: true
constant: true,
hideInMenu: true
}
},
{
Expand Down Expand Up @@ -184,7 +187,8 @@ export const generatedRoutes: GeneratedRoute[] = [
meta: {
title: 'login',
i18nKey: 'route.login',
constant: true
constant: true,
hideInMenu: true
}
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/router/guard/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Router } from 'vue-router';
import { createRouteGuard } from './route';
import { createProgressGuard } from './progress';
import { createDocumentTitleGuard } from './title';
import { createPermissionGuard } from './permission';
// import { createPermissionGuard } from './permission';

/**
* Router guard
Expand All @@ -10,6 +11,7 @@ import { createPermissionGuard } from './permission';
*/
export function createRouterGuard(router: Router) {
createProgressGuard(router);
createPermissionGuard(router);
createRouteGuard(router);
// createPermissionGuard(router);
createDocumentTitleGuard(router);
}
142 changes: 0 additions & 142 deletions src/router/guard/permission.ts

This file was deleted.

Loading

0 comments on commit 37d20b8

Please sign in to comment.