|  |  |  | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const doPostForm = async (url, params, fn) => { | 
|---|
|  |  |  | const res = await request(url, { | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | headers: { | 
|---|
|  |  |  | 'Content-Type': 'multipart/form-data' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data: params | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (fn) { | 
|---|
|  |  |  | fn(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const doPostBlob = async (url, params, fn) => { | 
|---|
|  |  |  | const res = await request(url, { | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | headers: { | 
|---|
|  |  |  | 'Content-Type': 'application/json' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | data: { ...params }, | 
|---|
|  |  |  | responseType: 'blob' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (fn) { | 
|---|
|  |  |  | fn(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const doPostPromise = (url, params, fn) => { | 
|---|
|  |  |  | return request(url, { | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const Http = { doGet, doGetPromise, doPost, doPostPromise } | 
|---|
|  |  |  | const Http = { doGet, doGetPromise, doPost, doPostForm, doPostPromise, doPostBlob } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default Http; | 
|---|