This commit is contained in:
2025-12-24 10:55:40 +08:00
parent eec9d6045c
commit 752bb23571
25 changed files with 2348 additions and 816 deletions

View File

@@ -37,13 +37,25 @@ export function post(url, data, options = {}) {
options.customHeaders['Content-Type'] = 'application/json';
}
}
return fetch(combineUrl(url), {
const opts = {
method: options.method || 'POST',
headers: options.customHeaders,
body: data,
signal: options.signal,
cache: 'no-cache'
});
};
if (options.diagnostic) {
const started = new Date().getTime();
return new Promise((resolve, reject) => {
fetch(combineUrl(url), opts).then(response => {
resolve({
time: new Date().getTime() - started,
response
});
}).catch(reject);
});
}
return fetch(combineUrl(url), opts);
}
export function upload(url, data, options = {}) {