From 809c14f91feebd77760f55c8632e6bb483299c62 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 21 Jun 2018 11:02:53 +0000 Subject: [PATCH] check status for complete and invalid --- lib/extensions/admin/login/js/app.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/extensions/admin/login/js/app.js b/lib/extensions/admin/login/js/app.js index 5655505..f8f29ab 100644 --- a/lib/extensions/admin/login/js/app.js +++ b/lib/extensions/admin/login/js/app.js @@ -13,9 +13,21 @@ function checkStatus() { }).then(function (resp) { return resp.json().then(function (data) { console.log(data); + if ('invalid' === data.status) { + window.alert("something went wrong"); + return; + } + if ('complete' === data.status) { + setTimeout(function () { + window.document.body.innerHTML += (''); + // TODO once this is loaded (even error) Let's Encrypt is done, + // then it's time to redirect to the domain. Yay! + }, 1 * 1000); + return; + } + setTimeout(checkStatus, 2 * 1000); }, function (err) { console.error(err); - }).then(function () { setTimeout(checkStatus, 2 * 1000); }); }); @@ -40,18 +52,7 @@ function submitCode(pair) { // TODO check for error (i.e. bad Pair Code / PIN) // shouldn't be pending (because we get here by being ready) // should poll over 'ready' - if ('invalid' === data.status) { - window.alert("something went wrong"); - return; - } - if ('complete' === data.status) { - setTimeout(function () { - window.document.body.innerHTML += (''); - // TODO once this is loaded (even error) Let's Encrypt is done, - // then it's time to redirect to the domain. Yay! - }, 1 * 1000); - return; - } + setTimeout(checkStatus, 0);