import Qs from 'qs'
import axios from "axios";
const Axios = axios.create()
Axios.defaults.baseURL = ' http://localhost:9527';
//Axios.defaults.headers.common["Content-Type"] = "application/x-www-form-urlencoded";
Axios.defaults.transformRequest = (data, headers) => {
const contentType = Axios.defaults.headers.common["Content-Type"];
if (contentType === 'application/x-www-form-urlencoded') {//对这种格式要特殊处理一下
return Qs.stringify(data);
}
return data;
}
Axios.interceptors.response.use(response => response.data, reson => Promise.reject(reson))
export default Axios;