add multi api supports
This commit is contained in:
parent
044064dcc6
commit
feea9009cb
@ -159,8 +159,10 @@ export default {
|
|||||||
fetch() {
|
fetch() {
|
||||||
Object.keys(this.chains).forEach(k => {
|
Object.keys(this.chains).forEach(k => {
|
||||||
const chain = this.chains[k]
|
const chain = this.chains[k]
|
||||||
|
const index = localStorage.getItem(`${chain.chain_name}-api-index`) || 0
|
||||||
if (chain.api) {
|
if (chain.api) {
|
||||||
fetch(`${chain.api}/blocks/latest`).then(res => res.json()).then(b => {
|
const host = Array.isArray(chain.api) ? chain.api[index] : chain.api
|
||||||
|
fetch(`${host}/blocks/latest`).then(res => res.json()).then(b => {
|
||||||
// console.log(b.block.header)
|
// console.log(b.block.header)
|
||||||
const { header } = b.block
|
const { header } = b.block
|
||||||
this.$set(chain, 'height', header.height)
|
this.$set(chain, 'height', header.height)
|
||||||
|
Loading…
Reference in New Issue
Block a user