Commit d11265df authored by lipengcheng 's avatar lipengcheng

chore: some changes

parent 4be751b4
......@@ -19,14 +19,12 @@ const apiMap = {
login: { method: 'post', url: '/login' }
}
// const requestMap = {}
function injectRequest(apiObj) {
const requestObj = {}
const requestMap = {}
Object.keys(apiObj).forEach((alias) => {
let { method, url, config } = apiObj[alias]
method = method.toUpperCase()
requestObj[alias] = (dataOrParams = {}, instanceConf = {}) => {
requestMap[alias] = (dataOrParams = {}, instanceConf = {}) => {
const keyName = ['PUT', 'POST', 'PATCH'].includes(method) ? 'data' : 'params'
return request({
method,
......@@ -36,7 +34,7 @@ function injectRequest(apiObj) {
})
}
})
return requestObj
return requestMap
}
export default injectRequest(apiMap)
......@@ -58,7 +58,7 @@ export default {
async mounted() {
let xx = await this.$api.getBanner({ pageSize: 20, pIndex: 2 })
console.log('xx:', xx)
let vv = await this.$api.login({ account: '18038018084', psw: '2' })
let vv = await this.$api.login({ account: '18038018084', psw: '123456' })
console.log('vv:', vv)
},
methods: {
......
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