fix null of coingecko
This commit is contained in:
parent
27ed7478df
commit
a8ef51909b
@ -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 => {
|
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
|
// use symbol as key instead of coingecko id
|
||||||
const quotes = {}
|
const quotes = {}
|
||||||
|
if (data && Object.keys(data)) {
|
||||||
Object.keys(data).forEach(k => {
|
Object.keys(data).forEach(k => {
|
||||||
quotes[coingecko[k]] = data[k]
|
quotes[coingecko[k]] = data[k]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
context.commit('setQuotes', quotes)
|
context.commit('setQuotes', quotes)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user