/**
* Created by CXG on 19/7/3.
*/
/**
* @param {Object} sapproval
* @param {Object} selfAction
* @returns {Object}
*/
export function actionInit(sapproval, selfAction) {
const resOBj = {}
if (sapproval) {
Object.keys(sapproval).forEach(function(key) {
resOBj[key] = ({ commit }, params) => {
return new Promise((resolve, reject) => {
sapproval[key](params).then(res => {
resolve(res)
}).catch(error => {
reject(error)
})
})
}
})
}
if (selfAction) {
return Object.assign(resOBj, selfAction)
} else {
return resOBj
}
}
-
wangdanlei authoredabaf891d