forked from cerc-io/cosmos-explorer
fix api issue on osmosis
This commit is contained in:
parent
a26765ad4b
commit
e5e296fe99
@ -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 = ''
|
||||
|
Loading…
Reference in New Issue
Block a user