From a8ef51909ba22c016d3863d4fb7c3d81939ae45e Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 1 Nov 2022 07:33:49 +0800 Subject: [PATCH] fix null of coingecko --- src/store/chains/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/store/chains/index.js b/src/store/chains/index.js index 013e75c3..a96d43b0 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -95,9 +95,11 @@ export default { fetch(`https://api.coingecko.com/api/v3/simple/price?include_24hr_change=true&vs_currencies=${currencies}&ids=${keys.join(',')}`).then(data => data.json()).then(data => { // use symbol as key instead of coingecko id const quotes = {} - Object.keys(data).forEach(k => { - quotes[coingecko[k]] = data[k] - }) + if (data && Object.keys(data)) { + Object.keys(data).forEach(k => { + quotes[coingecko[k]] = data[k] + }) + } context.commit('setQuotes', quotes) }) }