|
@@ -1,6 +1,7 @@
|
|
|
import Vue from 'vue';
|
|
|
import Vuex from 'vuex';
|
|
|
import _ from 'lodash';
|
|
|
+import axios from 'axios';
|
|
|
Vue.use(Vuex);
|
|
|
const api = {
|
|
|
interface: `/api/train/apply`,
|
|
@@ -34,6 +35,15 @@ const actions = {
|
|
|
const res = await this.$axios.$get(`${api.apply}`, { skip, limit, ...info });
|
|
|
return res;
|
|
|
},
|
|
|
+ async mergeRequest({ commit, dispatch }, { method, data }) {
|
|
|
+ let toRequest = () => {
|
|
|
+ let res = [];
|
|
|
+ res.push(dispatch(method, data));
|
|
|
+ };
|
|
|
+ let result = await axios.all(toRequest());
|
|
|
+ let arr = _.flattenDeep(_.flattenDeep(result).map(item => item.data));
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
};
|
|
|
export default {
|
|
|
namespaced: true,
|