check status for complete and invalid

This commit is contained in:
AJ ONeal 2018-06-21 11:02:53 +00:00
parent 79648af88c
commit 809c14f91f
1 changed files with 14 additions and 13 deletions

View File

@ -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 += ('<img src="https://' + domainname + '/_apis/telebit.cloud/clear.gif">');
// 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 += ('<img src="https://' + domainname + '/">');
// 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);