client/api: handle expired uploads
This commit is contained in:
parent
cc969a808f
commit
ecf347ef6e
|
@ -176,9 +176,17 @@ class Api extends events.EventTarget {
|
||||||
url, requestFactory, data, {}, options);
|
url, requestFactory, data, {}, options);
|
||||||
abortFunction = () => requestPromise.abort();
|
abortFunction = () => requestPromise.abort();
|
||||||
return requestPromise;
|
return requestPromise;
|
||||||
},
|
})
|
||||||
error => {
|
.catch(error => {
|
||||||
// TODO: check if the error is because of expired uploads
|
if (error.response.name ===
|
||||||
|
'MissingOrExpiredRequiredFileError') {
|
||||||
|
for (let key of Object.keys(files)) {
|
||||||
|
files[key].token = null;
|
||||||
|
}
|
||||||
|
error.message =
|
||||||
|
'The uploaded file has expired; ' +
|
||||||
|
'please resend the form to reupload.';
|
||||||
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
});
|
});
|
||||||
promise.abort = () => abortFunction();
|
promise.abort = () => abortFunction();
|
||||||
|
|
Loading…
Reference in New Issue