add promise
This commit is contained in:
		@@ -24,25 +24,28 @@ const permission = {
 | 
				
			|||||||
  actions: {
 | 
					  actions: {
 | 
				
			||||||
    // s
 | 
					    // s
 | 
				
			||||||
    GenerateRoutes({ commit }, data) {
 | 
					    GenerateRoutes({ commit }, data) {
 | 
				
			||||||
      const { roles } = data;
 | 
					      return new Promise(resolve => {
 | 
				
			||||||
      const accessedRouters = asyncRouterMap.filter(v => {
 | 
					        const { roles } = data;
 | 
				
			||||||
        if (roles.indexOf('admin') >= 0) return true;
 | 
					        const accessedRouters = asyncRouterMap.filter(v => {
 | 
				
			||||||
        if (hasPermission(roles, v)) {
 | 
					          if (roles.indexOf('admin') >= 0) return true;
 | 
				
			||||||
          if (v.children && v.children.length > 0) {
 | 
					          if (hasPermission(roles, v)) {
 | 
				
			||||||
            v.children = v.children.filter(child => {
 | 
					            if (v.children && v.children.length > 0) {
 | 
				
			||||||
              if (hasPermission(roles, child)) {
 | 
					              v.children = v.children.filter(child => {
 | 
				
			||||||
                return child
 | 
					                if (hasPermission(roles, child)) {
 | 
				
			||||||
              }
 | 
					                  return child
 | 
				
			||||||
              return false;
 | 
					                }
 | 
				
			||||||
            });
 | 
					                return false;
 | 
				
			||||||
            return v
 | 
					              });
 | 
				
			||||||
          } else {
 | 
					              return v
 | 
				
			||||||
            return v
 | 
					            } else {
 | 
				
			||||||
 | 
					              return v
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					          return false;
 | 
				
			||||||
        return false;
 | 
					        });
 | 
				
			||||||
      });
 | 
					        commit('SET_ROUTERS', accessedRouters);
 | 
				
			||||||
      commit('SET_ROUTERS', accessedRouters);
 | 
					        resolve();
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user