Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
7e2500c7
Commit
7e2500c7
authored
Apr 10, 2019
by
ιε°θͺ
Committed by
ιεΈ
Apr 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove serve authRoutes (#3946)
parent
ac55ffce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
39 deletions
+1
-39
mock/route.js
mock/route.js
+0
-5
src/app.js
src/app.js
+1
-34
No files found.
mock/route.js
deleted
100644 β 0
View file @
ac55ffce
export
default
{
'
/api/auth_routes
'
:
{
'
/form/advanced-form
'
:
{
authority
:
[
'
admin
'
,
'
user
'
]
},
},
};
src/app.js
View file @
7e2500c7
import
fetch
from
'
dva/fetch
'
;
export
const
dva
=
{
config
:
{
onError
(
err
)
{
...
...
@@ -8,37 +6,6 @@ export const dva = {
},
};
let
authRoutes
=
{};
function
ergodicRoutes
(
routes
,
authKey
,
authority
)
{
routes
.
forEach
(
element
=>
{
if
(
element
.
path
===
authKey
)
{
if
(
!
element
.
authority
)
element
.
authority
=
[];
// eslint-disable-line
Object
.
assign
(
element
.
authority
,
authority
||
[]);
}
else
if
(
element
.
routes
)
{
ergodicRoutes
(
element
.
routes
,
authKey
,
authority
);
}
return
element
;
});
}
export
function
patchRoutes
(
routes
)
{
Object
.
keys
(
authRoutes
).
map
(
authKey
=>
ergodicRoutes
(
routes
,
authKey
,
authRoutes
[
authKey
].
authority
)
);
window
.
g_routes
=
routes
;
}
export
function
render
(
oldRender
)
{
fetch
(
'
/api/auth_routes
'
)
.
then
(
res
=>
res
.
json
())
.
then
(
ret
=>
{
authRoutes
=
ret
;
oldRender
();
},
()
=>
{
oldRender
();
}
);
oldRender
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment