add promise

This commit is contained in:
Pan 2017-05-17 17:53:37 +08:00
parent faea4d8bf6
commit 523a9b3de3

View file

@ -24,6 +24,7 @@ const permission = {
actions: {
// s
GenerateRoutes({ commit }, data) {
return new Promise(resolve => {
const { roles } = data;
const accessedRouters = asyncRouterMap.filter(v => {
if (roles.indexOf('admin') >= 0) return true;
@ -43,6 +44,8 @@ const permission = {
return false;
});
commit('SET_ROUTERS', accessedRouters);
resolve();
})
}
}
};