Skip to content

Commit

Permalink
chore(hapi): use response if the usd attribute is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Torresmorah committed Jan 31, 2023
1 parent 8e3f3c4 commit 3c0360e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hapi/src/services/setting.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ const syncEOSPrice = async () => {
return
}

const response = data[eosConfig.coingeckoApiTokenId]
const tokenPrice = !isNaN(response?.usd) ? response.usd : response

await hasuraUtil.request(UPSERT, {
setting: { id: 1, token_price: data[eosConfig.coingeckoApiTokenId].usd }
setting: { id: 1, token_price: tokenPrice }
})
} catch (error) {
console.error(error)
Expand Down

0 comments on commit 3c0360e

Please sign in to comment.