24 lines
541 B
JavaScript
24 lines
541 B
JavaScript
import axios from 'axios';
|
||
|
||
const service = axios.create({
|
||
baseURL: '/api', //api 的 base_url,根据开发生产环境配置文件配置
|
||
withCredentials: true, // 跨域请求时发送 cookies
|
||
timeout: 0,
|
||
headers: {
|
||
'Content-Type': 'application/json;charset=UTF-8',
|
||
},
|
||
responseType: 'json',
|
||
});
|
||
|
||
const post = (url, data, config) => {
|
||
return service.post(url, data, config);
|
||
};
|
||
|
||
const get = (url, data) => {
|
||
return service.get(url, {
|
||
params: data,
|
||
});
|
||
};
|
||
|
||
export { post, get, service };
|