diff --git a/scripts/Utils/fetchWithProgress.ts b/scripts/Utils/fetchWithProgress.ts index b2e990b3..224a61b3 100644 --- a/scripts/Utils/fetchWithProgress.ts +++ b/scripts/Utils/fetchWithProgress.ts @@ -10,8 +10,12 @@ export function fetchWithProgress(url, options: RequestInit, onProgress: ((this: xhr.onload = e => resolve(xhr.responseText) xhr.onerror = reject - if(xhr.upload && onProgress) { - xhr.upload.onprogress = onProgress + if(onProgress) { + xhr.addEventListener("progress", onProgress) + + if(xhr.upload) { + xhr.upload.onprogress = onProgress + } } xhr.send(options.body)