Commit 228e732a authored by lipengcheng 's avatar lipengcheng

fix: xx

parent a0f96826
......@@ -24,14 +24,14 @@ const apiMap = {
login: { method: 'post', url: '/login' }
}
function injectRequest(apiObj) {
function injectRequest(apiObj, axios) {
const requestMap = {}
Object.keys(apiObj).forEach((alias) => {
let { method, url, config } = apiObj[alias]
method = method.toUpperCase()
requestMap[alias] = (dataOrParams = {}, instanceConf = {}) => {
const keyName = ['PUT', 'POST', 'PATCH'].includes(method) ? 'data' : 'params'
return request({
return axios({
method,
url,
// [keyName]: method === 'POST' ? qs.stringify(dataOrParams) : dataOrParams,
......@@ -43,4 +43,4 @@ function injectRequest(apiObj) {
return requestMap
}
export default injectRequest(apiMap)
export default injectRequest(apiMap, request)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment