Skip to content

Commit

Permalink
one unique definition of
Browse files Browse the repository at this point in the history
  • Loading branch information
lollerfirst committed Aug 15, 2024
1 parent 0de422f commit 3d31d88
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/components/BalanceView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ import ToggleUnit from "components/ToggleUnit.vue";
import axios from "axios";
async function fetchBitcoinPrice() {
var { data } = await axios.get(
"https://api.coinbase.com/v2/exchange-rates?currency=BTC"
);
return data.data.rates.USD;
}
export default defineComponent({
name: "BalanceView",
mixins: [windowMixin],
Expand Down Expand Up @@ -206,12 +199,14 @@ export default defineComponent({
...mapActions(useWalletStore, [
"checkPendingInvoices",
"checkPendingTokens",
"fetchBitcoinPriceUSD",
]),
async fetchPrice() {
try {
this.bitcoinPrice = await fetchBitcoinPrice();
this.bitcoinPrice = await this.fetchBitcoinPriceUSD();
console.log(`bitcoinPrice: ${this.bitcoinPrice}`);
} catch (e) {
console.warn("Could not get Bitcoin price.");
console.warn(`Could not get Bitcoin price. ${e}`);
}
},
toggleUnit: function () {
Expand All @@ -221,8 +216,8 @@ export default defineComponent({
return this.activeUnit;
},
toggleHideBalance() {
this.hideBalance = !this.hideBalance
}
this.hideBalance = !this.hideBalance;
},
},
});
</script>

0 comments on commit 3d31d88

Please sign in to comment.