From 2382db1d614f390f4da44a657a7a594e13831c0d Mon Sep 17 00:00:00 2001 From: Duddino Date: Thu, 28 Sep 2023 12:22:46 +0200 Subject: [PATCH] Add ref + fix typo --- scripts/WalletBalance.vue | 4 +++- scripts/settings.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/WalletBalance.vue b/scripts/WalletBalance.vue index c0fa665b9..2ccfe6ebe 100644 --- a/scripts/WalletBalance.vue +++ b/scripts/WalletBalance.vue @@ -24,11 +24,12 @@ import { wallet, getNewAddress } from './wallet'; const balance = ref(0); const price = ref(0.0); +const displayDecimals = ref(0); const updating = ref(false); const currency = ref('USD'); const balanceStr = computed(() => { const nCoins = balance.value / COIN; - const strBal = nCoins.toFixed(nDisplayDecimals); + const strBal = nCoins.toFixed(displayDecimals.value); const nLen = strBal.length; return beautifyNumber(strBal, nLen >= 10 ? '17px' : '25px'); }); @@ -56,6 +57,7 @@ getEventEmitter().on('balance-update', async () => { balance.value = mempool.getBalance(); currency.value = strCurrency.toUpperCase(); price.value = await cMarket.getPrice(strCurrency); + displayDecimals.value = nDisplayDecimals; }); getEventEmitter().on('sync-status', (value) => { diff --git a/scripts/settings.js b/scripts/settings.js index f03716269..a63b223c5 100644 --- a/scripts/settings.js +++ b/scripts/settings.js @@ -340,7 +340,7 @@ async function setDecimals(decimals) { const database = await Database.getInstance(); database.setSettings({ displayDecimals: nDisplayDecimals }); // Update the UI to reflect the new decimals - getEventEmitter().emit('new-balance'); + getEventEmitter().emit('balance-update'); getStakingBalance(true); }