Fix ESLint issues

This commit is contained in:
2025-04-03 22:37:22 +02:00
parent 92ce2e68ad
commit 03f57a0ad7
5 changed files with 20 additions and 17 deletions

View File

@ -66,23 +66,25 @@ export class APIClient {
if (args.upProgress) {
const res: XMLHttpRequest = await new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", (e) =>
{ args.upProgress!(e.loaded / e.total); }
);
xhr.addEventListener("load", () => { resolve(xhr); });
xhr.addEventListener("error", () =>
{ reject(new Error("File upload failed")); }
);
xhr.addEventListener("abort", () =>
{ reject(new Error("File upload aborted")); }
);
xhr.addEventListener("timeout", () =>
{ reject(new Error("File upload timeout")); }
);
xhr.upload.addEventListener("progress", (e) => {
args.upProgress!(e.loaded / e.total);
});
xhr.addEventListener("load", () => {
resolve(xhr);
});
xhr.addEventListener("error", () => {
reject(new Error("File upload failed"));
});
xhr.addEventListener("abort", () => {
reject(new Error("File upload aborted"));
});
xhr.addEventListener("timeout", () => {
reject(new Error("File upload timeout"));
});
xhr.open(args.method, url, true);
xhr.withCredentials = true;
for (const key in headers) {
if (headers.hasOwnProperty(key))
if (Object.prototype.hasOwnProperty.call(headers, key))
xhr.setRequestHeader(key, headers[key]);
}
xhr.send(body);