This commit is contained in:
parent
c29caf01c8
commit
9d80345b77
7 changed files with 332 additions and 15 deletions
|
|
@ -126,10 +126,17 @@ export const apiClient = {
|
|||
const fullUrl = queryString ? `${url}?${queryString}` : url;
|
||||
return request(fullUrl, { method: 'GET' });
|
||||
},
|
||||
post: (url, data) => request(url, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
}),
|
||||
post: (url, data) => {
|
||||
const isFormData = data instanceof FormData
|
||||
|
||||
return request(url, {
|
||||
method: 'POST',
|
||||
body: isFormData ? data : JSON.stringify(data),
|
||||
headers: isFormData
|
||||
? {}
|
||||
: { 'Content-Type': 'application/json' }
|
||||
})
|
||||
},
|
||||
put: (url, data) => request(url, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(data),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue