fix api issue on osmosis

This commit is contained in:
liangping 2022-03-12 13:59:58 +08:00
parent a26765ad4b
commit e5e296fe99

View File

@ -91,10 +91,18 @@ export default class OsmosAPI {
async get(url) {
const chains = getLocalChains()
this.host = chains.osmosis.api
const conf = chains.osmosis
const index = this.getApiIndex(conf)
this.host = Array.isArray(conf.api) ? conf.api[index] : conf.api
return fetch(`${this.host}${url}`).then(res => res.json())
}
getApiIndex(config = null) {
const conf = config || this.config
const index = Number(localStorage.getItem(`${conf.chain_name}-api-index`) || 0)
return index < conf.api.length ? index : 0
}
async getMarketData(from, to, days = 14) {
if (from && to) {
this.exe_time = ''