start grid
This commit is contained in:
@ -8,8 +8,7 @@ function combineUrl(url) {
|
||||
return (consts.path || '') + url;
|
||||
}
|
||||
|
||||
function get(url, options) {
|
||||
options ??= {};
|
||||
function get(url, options = {}) {
|
||||
return fetch(combineUrl(url), {
|
||||
method: options.method || 'GET',
|
||||
headers: {
|
||||
@ -21,8 +20,7 @@ function get(url, options) {
|
||||
});
|
||||
}
|
||||
|
||||
function post(url, data, options) {
|
||||
options ??= {};
|
||||
function post(url, data, options = {}) {
|
||||
// let contentType;
|
||||
if (data instanceof FormData) {
|
||||
// contentType = 'multipart/form-data';
|
||||
@ -47,7 +45,7 @@ function post(url, data, options) {
|
||||
});
|
||||
}
|
||||
|
||||
function upload(url, data, options) {
|
||||
function upload(url, data, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = new XMLHttpRequest();
|
||||
request.onreadystatechange = function () {
|
||||
@ -59,7 +57,6 @@ function upload(url, data, options) {
|
||||
}
|
||||
}
|
||||
};
|
||||
options ??= {};
|
||||
if (typeof options.progress === 'function') {
|
||||
request.upload.addEventListener('progress', function (ev) {
|
||||
if (ev.lengthComputable) {
|
||||
|
Reference in New Issue
Block a user