request请求封装
作者:互联网
import axios from "axios"; const baseUrl = "http:/123.57.50.179:8900"; const getRequest = (path, params) => { return axios.get(baseUrl + path, { params: { ...params }, }); }; const postRequest = (path, data) => { return JSON.stringify(data) != null ? axios.post(baseUrl + path, { ...data, }) : axios.post(baseUrl + path); }; export { getRequest, postRequest };
标签:axios,封装,请求,request,baseUrl,params,path,data,const 来源: https://www.cnblogs.com/Jarsmine/p/16395291.html