axios.js
526 字节
/**
* @file Axios 全局配置
*/
import axios from 'axios'
const myAxios = axios.create({
// baseURL: process.env.VUE_APP_MID_REQUEST_BASE_URL,
// withCredentials: true
})
myAxios.defaults.timeout = 100000;
myAxios.interceptors.response.use((res) => {
if (res.status >= 200 && res.status < 300) {
return res;
}
return Promise.reject(res);
}, (error) => {
var err = { message: '网络异常,请刷新重试', err: error, type: 'responseError' };
return Promise.reject(err);
});
export default myAxios