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

feat: add configuration parameter for request.js;
master
chenghongxing 4 years ago
parent 62b57a97cb
commit df076bda24
  1. 8
      src/utils/request.js

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

Loading…
Cancel
Save