Skip to content

Commit 05ca5ca

Browse files
committed
add role mock
1 parent f3aefe5 commit 05ca5ca

File tree

3 files changed

+531
-8
lines changed

3 files changed

+531
-8
lines changed

mock/role/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
import Mock from 'mockjs'
2-
// import { deepClone } from '@/utils'
3-
// import { filterAsyncRoutes } from '@/store/modules/permission'
4-
// import { asyncRoutes, constantRoutes } from '@/router'
2+
import { deepClone } from '../../src/utils/index.js'
3+
import { asyncRoutes, constantRoutes } from './routes.js'
54

6-
// const routes = deepClone([...constantRoutes, ...asyncRoutes])
5+
const routes = deepClone([...constantRoutes, ...asyncRoutes])
76

87
const roles = [
98
{
109
key: 'admin',
1110
name: 'admin',
1211
description: 'Super Administrator. Have access to view all pages.',
13-
routes: []
12+
routes: routes
1413
},
1514
{
1615
key: 'editor',
1716
name: 'editor',
1817
description: 'Normal Editor. Can see all pages except permission page',
19-
routes: []
18+
routes: routes.filter(i => i.path !== '/permission')// just a mock
2019
},
2120
{
2221
key: 'visitor',
@@ -38,7 +37,7 @@ const roles = [
3837

3938
export default {
4039
'/routes': () => {
41-
return []
40+
return routes
4241
},
4342
'/roles': () => {
4443
return roles

0 commit comments

Comments
 (0)