bug fix
This commit is contained in:
parent
3c2adeb52b
commit
7f58aa12d6
65
index.html
65
index.html
@ -7863,37 +7863,40 @@
|
|||||||
util: {
|
util: {
|
||||||
serverList: floGlobals.apiURL[floGlobals.blockchain].slice(0),
|
serverList: floGlobals.apiURL[floGlobals.blockchain].slice(0),
|
||||||
curPos: floCrypto.randInt(0, floGlobals.apiURL[floGlobals.blockchain].length - 1),
|
curPos: floCrypto.randInt(0, floGlobals.apiURL[floGlobals.blockchain].length - 1),
|
||||||
fetch_retry: function (apicall) {
|
fetch_retry: function (apicall, rm_flosight) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.serverList.splice(this.curPos, 1);
|
let i = this.serverList.indexOf(rm_flosight)
|
||||||
this.curPos = floCrypto.randInt(0, this.serverList.length - 1)
|
if(i != -1)
|
||||||
this.fetch_api(apicall)
|
this.serverList.splice(i, 1);
|
||||||
.then(result => resolve(result))
|
this.curPos = floCrypto.randInt(0, this.serverList.length)
|
||||||
.catch(error => reject(error));
|
this.fetch_api(apicall)
|
||||||
})
|
.then(result => resolve(result))
|
||||||
},
|
.catch(error => reject(error));
|
||||||
fetch_api: function (apicall) {
|
})
|
||||||
return new Promise((resolve, reject) => {
|
},
|
||||||
if (this.serverList.length === 0)
|
fetch_api: function (apicall) {
|
||||||
reject("No floSight server working")
|
return new Promise((resolve, reject) => {
|
||||||
else {
|
if (this.serverList.length === 0)
|
||||||
fetch(this.serverList[this.curPos] + apicall).then(response => {
|
reject("No floSight server working")
|
||||||
if (response.ok)
|
else {
|
||||||
response.json().then(data => resolve(data));
|
let flosight = this.serverList[this.curPos];
|
||||||
else {
|
fetch(flosight + apicall).then(response => {
|
||||||
this.fetch_retry(apicall)
|
if (response.ok)
|
||||||
.then(result => resolve(result))
|
response.json().then(data => resolve(data));
|
||||||
.catch(error => reject(error));
|
else {
|
||||||
}
|
this.fetch_retry(apicall, flosight)
|
||||||
}).catch(error => {
|
.then(result => resolve(result))
|
||||||
this.fetch_retry(apicall)
|
.catch(error => reject(error));
|
||||||
.then(result => resolve(result))
|
}
|
||||||
.catch(error => reject(error));
|
}).catch(error => {
|
||||||
})
|
this.fetch_retry(apicall, flosight)
|
||||||
}
|
.then(result => resolve(result))
|
||||||
})
|
.catch(error => reject(error));
|
||||||
}
|
})
|
||||||
},
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
//Promised function to get data from API
|
//Promised function to get data from API
|
||||||
promisedAPI: function (apicall) {
|
promisedAPI: function (apicall) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user