typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.
This commit is contained in:
@@ -5,7 +5,7 @@ export async function createUpload(
|
||||
it: QueueItem,
|
||||
deviceId: string,
|
||||
onProgress?: (percent: number) => void
|
||||
): Promise<any> {
|
||||
): Promise<Record<string, unknown>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', url, true);
|
||||
@@ -22,7 +22,12 @@ export async function createUpload(
|
||||
};
|
||||
xhr.onload = () => {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
try { resolve(JSON.parse(xhr.responseText)); } catch { resolve({}); }
|
||||
try {
|
||||
resolve(JSON.parse(xhr.responseText));
|
||||
} catch (error) {
|
||||
console.warn('Upload response parse failed', error);
|
||||
resolve({});
|
||||
}
|
||||
} else {
|
||||
reject(new Error('upload failed'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user