From feea9009cb27174274bebcd683ff4fea45cb820a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 11 Jan 2022 21:08:25 +0800 Subject: [PATCH] add multi api supports --- src/views/Home.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 061666a0..89aa3024 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -159,8 +159,10 @@ export default { fetch() { Object.keys(this.chains).forEach(k => { const chain = this.chains[k] + const index = localStorage.getItem(`${chain.chain_name}-api-index`) || 0 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) const { header } = b.block this.$set(chain, 'height', header.height)