diff --git a/assets/script.js b/assets/script.js index f5482fd..fce9d3a 100644 --- a/assets/script.js +++ b/assets/script.js @@ -12,6 +12,16 @@ function isLoggedIn() { 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) { "use strict"; const statusMessageContainer = document.getElementById("statusMessageContainer"); @@ -594,7 +604,7 @@ async function getFileList() { } }; xhr.send(formData); - while (tmp === undefined); + until(_ => (tmp !== undefined)); return tmp; }