adjustment

This commit is contained in:
2023-07-27 10:03:53 +08:00
parent 3e9ee59178
commit 29209a3a00
17 changed files with 456 additions and 173 deletions

View File

@ -8,7 +8,7 @@ function combineUrl(url) {
return (consts.path || '') + url;
}
function get(url, options = {}) {
export function get(url, options = {}) {
return fetch(combineUrl(url), {
method: options.method || 'GET',
headers: {
@ -21,7 +21,7 @@ function get(url, options = {}) {
});
}
function post(url, data, options = {}) {
export function post(url, data, options = {}) {
// let contentType;
if (data instanceof FormData) {
// contentType = 'multipart/form-data';
@ -46,7 +46,7 @@ function post(url, data, options = {}) {
});
}
function upload(url, data, options = {}) {
export function upload(url, data, options = {}) {
return new Promise((resolve, reject) => {
const request = new XMLHttpRequest();
request.onreadystatechange = function () {
@ -73,10 +73,4 @@ function upload(url, data, options = {}) {
}
request.send(data);
});
}
export {
get,
post,
upload
}