sync
This commit is contained in:
@@ -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 = {}) {
|
||||
|
||||
Reference in New Issue
Block a user