|
@@ -1,7 +1,8 @@
|
|
|
import Vue from 'vue';
|
|
|
import Vuex from 'vuex';
|
|
|
import _ from 'lodash';
|
|
|
-import axios from 'axios';
|
|
|
+// import axios from 'axios';
|
|
|
+import AxiosWrapper from '../utils/axios-wrapper';
|
|
|
Vue.use(Vuex);
|
|
|
const api = {
|
|
|
interface: `/api/train/setting/findone`,
|
|
@@ -17,12 +18,11 @@ const actions = {
|
|
|
return res;
|
|
|
},
|
|
|
async fetch({ commit }, payload) {
|
|
|
- const res = await axios.get(api.interface);
|
|
|
- if (res.status == 200) {
|
|
|
- if (res.data && res.data.errcode == 0) {
|
|
|
- commit('setDefOpt', res.data.data, { root: true });
|
|
|
- return res.data;
|
|
|
- }
|
|
|
+ const axios = new AxiosWrapper({ baseUrl: process.env.VUE_APP_AXIOS_BASE_URL, unwrap: true });
|
|
|
+ const res = await axios.$get(api.interface);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ commit('setDefOpt', res.data, { root: true });
|
|
|
+ return res;
|
|
|
}
|
|
|
},
|
|
|
async checkCache({ rootState, commit, dispatch }) {
|