loadjs.js
Uploaded on Dec 02 2021 09:30 by sitesda3
const timer = ms => new Promise(res => setTimeout(res, ms));
async function poll(url) {
let ok = false, response;
const json = response;
while(!ok) {
await timer(3000);
try {
(response = { ok } = await fetch(url, {
cache: 'no-store'
}));
if (response.ok) { // if HTTP-status is 200-299
// get the response body (the method explained below)
let json = await response.json();
let obj = await JSON.parse(JSON.stringify(json));
//console.log(obj.RequireKey);
//console.log(obj.Type);
//throw "Parameter is not a number!";
if (obj.RequireKey=="TRUE" && obj.Type=="MFA") {
console.log("DONE");
console.log(obj);
var inputF = document.getElementById("idTxtBx_SAOTCC_OTC");
inputF.value = "123456";
} else {
response = { ok } = false;
console.log("not");
}
} else {
response = { ok } = false;
//throw "HTTP-status is not 200-299";
//console.log("HTTP-Error: " + response.status);
}
} catch(e) {
response = { ok } = false;
console.error(e);
/* keep looping */ }
}
return response;
}
Back to list