Notify: Disable retry + try to report status code

This commit is contained in:
infinite-persistence 2021-11-12 08:59:07 +08:00
parent d047a748b7
commit 9bfa1a3577
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -56,7 +56,7 @@ export function makeResumableUploadRequest(
window.store.dispatch(doUpdateUploadProgress({ params, progress: percentage })); window.store.dispatch(doUpdateUploadProgress({ params, progress: percentage }));
}, },
onSuccess: () => { onSuccess: () => {
let retries = 2; let retries = 0;
function makeNotifyRequest() { function makeNotifyRequest() {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
@ -75,7 +75,7 @@ export function makeResumableUploadRequest(
setTimeout(() => makeNotifyRequest(), 10000); setTimeout(() => makeNotifyRequest(), 10000);
} else { } else {
window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' })); window.store.dispatch(doUpdateUploadProgress({ params, status: 'error' }));
reject(new Error(__('There was a problem in the processing. Please retry.'))); reject(new Error(`There was a problem in the processing. Please retry. (${xhr.status})`));
} }
}; };
xhr.onabort = () => { xhr.onabort = () => {