Improved uploader
This commit is contained in:
parent
d9ff1513b8
commit
0f28cdbc3d
@ -10,9 +10,13 @@ export function fetchWithProgress(url, options: RequestInit, onProgress: ((this:
|
||||
xhr.onload = e => resolve(xhr.responseText)
|
||||
xhr.onerror = reject
|
||||
|
||||
if(xhr.upload && onProgress) {
|
||||
if(onProgress) {
|
||||
xhr.addEventListener("progress", onProgress)
|
||||
|
||||
if(xhr.upload) {
|
||||
xhr.upload.onprogress = onProgress
|
||||
}
|
||||
}
|
||||
|
||||
xhr.send(options.body)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user