check status for complete and invalid
This commit is contained in:
parent
79648af88c
commit
809c14f91f
|
@ -13,9 +13,21 @@ function checkStatus() {
|
||||||
}).then(function (resp) {
|
}).then(function (resp) {
|
||||||
return resp.json().then(function (data) {
|
return resp.json().then(function (data) {
|
||||||
console.log(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) {
|
}, function (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}).then(function () {
|
|
||||||
setTimeout(checkStatus, 2 * 1000);
|
setTimeout(checkStatus, 2 * 1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -40,18 +52,7 @@ function submitCode(pair) {
|
||||||
// TODO check for error (i.e. bad Pair Code / PIN)
|
// TODO check for error (i.e. bad Pair Code / PIN)
|
||||||
// shouldn't be pending (because we get here by being ready)
|
// shouldn't be pending (because we get here by being ready)
|
||||||
// should poll over '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);
|
setTimeout(checkStatus, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue