Update api.js

This commit is contained in:
北海一刀 2021-11-17 14:31:31 +08:00
parent a7b21d4d06
commit 62f8397c4a
1 changed files with 11 additions and 5 deletions

View File

@ -25,13 +25,19 @@ const req = (method, url, params, responseType) => {
} }
} }
let http = fetch(url,obj).then(res => res.json()); let http = fetch(url,obj).then(res => res.json());
return http.then(response => response.data).catch(error => console.error('Error:', error)); return http.then(response => response).catch(error => console.error('Error:', error));
} }
export const handelResponse=(res, cb, errCb)=> {
console.log(res)
if (res.code == 200) {
cb(res)
} else {
if (typeof errCb == 'function') {
errCb()
}
}
}
//营销计划列表 //营销计划列表
export const getPlanList = (params) => { export const getPlanList = (params) => {
return req('get', baseurl + "/plan", params) return req('get', baseurl + "/plan", params)