File tree Expand file tree Collapse file tree 1 file changed +21
-18
lines changed Expand file tree Collapse file tree 1 file changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -24,25 +24,28 @@ const permission = {
2424 actions : {
2525 // s
2626 GenerateRoutes ( { commit } , data ) {
27- const { roles } = data ;
28- const accessedRouters = asyncRouterMap . filter ( v => {
29- if ( roles . indexOf ( 'admin' ) >= 0 ) return true ;
30- if ( hasPermission ( roles , v ) ) {
31- if ( v . children && v . children . length > 0 ) {
32- v . children = v . children . filter ( child => {
33- if ( hasPermission ( roles , child ) ) {
34- return child
35- }
36- return false ;
37- } ) ;
38- return v
39- } else {
40- return v
27+ return new Promise ( resolve => {
28+ const { roles } = data ;
29+ const accessedRouters = asyncRouterMap . filter ( v => {
30+ if ( roles . indexOf ( 'admin' ) >= 0 ) return true ;
31+ if ( hasPermission ( roles , v ) ) {
32+ if ( v . children && v . children . length > 0 ) {
33+ v . children = v . children . filter ( child => {
34+ if ( hasPermission ( roles , child ) ) {
35+ return child
36+ }
37+ return false ;
38+ } ) ;
39+ return v
40+ } else {
41+ return v
42+ }
4143 }
42- }
43- return false ;
44- } ) ;
45- commit ( 'SET_ROUTERS' , accessedRouters ) ;
44+ return false ;
45+ } ) ;
46+ commit ( 'SET_ROUTERS' , accessedRouters ) ;
47+ resolve ( ) ;
48+ } )
4649 }
4750 }
4851} ;
You can’t perform that action at this time.
0 commit comments