This commit is contained in:
Bruno Rybársky 2024-04-25 22:45:07 +02:00
parent 03556a1642
commit d2d23d1514

@ -12,6 +12,16 @@ function isLoggedIn() {
return UserInfo.Email && 0 < UserInfo.Email.length; return UserInfo.Email && 0 < UserInfo.Email.length;
} }
function until(conditionFunction) {
const poll = resolve => {
if(conditionFunction()) resolve();
else setTimeout(_ => poll(resolve), 400);
}
return new Promise(poll);
}
async function handleResponse(data, successMessage, failureMessage) { async function handleResponse(data, successMessage, failureMessage) {
"use strict"; "use strict";
const statusMessageContainer = document.getElementById("statusMessageContainer"); const statusMessageContainer = document.getElementById("statusMessageContainer");
@ -594,7 +604,7 @@ async function getFileList() {
} }
}; };
xhr.send(formData); xhr.send(formData);
while (tmp === undefined); until(_ => (tmp !== undefined));
return tmp; return tmp;
} }