新增:request.js 增加请求配置参数;

feat: add configuration parameter for request.js;
This commit is contained in:
chenghongxing 2021-01-12 11:51:29 +08:00
parent 21c99ab8cf
commit c9b0fc2fc7

View File

@ -30,14 +30,14 @@ const METHOD = {
* @param params 请求参数
* @returns {Promise<AxiosResponse<T>>}
*/
async function request(url, method, params) {
async function request(url, method, params, config) {
switch (method) {
case METHOD.GET:
return axios.get(url, {params})
return axios.get(url, {params, ...config})
case METHOD.POST:
return axios.post(url, params)
return axios.post(url, params, config)
default:
return axios.get(url, {params})
return axios.get(url, {params, ...config})
}
}