diff --git a/frontend/src/common/server.js b/frontend/src/common/server.js index 0b87191fb..7d4016efc 100644 --- a/frontend/src/common/server.js +++ b/frontend/src/common/server.js @@ -36,8 +36,17 @@ function poll(interval, maxAttempts) { try { const xhr = new XMLHttpRequest(); xhr.open("GET", config.apiUri + "/status", false); + xhr.onload = function () { + if (this.status === 200) { + return resolve(); + } else { + throw new Error("request failed"); + } + }; + xhr.onerror = function () { + throw new Error("request failed"); + }; xhr.send(); - return resolve(); } catch { if (maxAttempts && attempts === maxAttempts) { return reject(new Error("exceeded max attempts"));