From 18d69cbf862aa653570b73e6846fc488f833e3a9 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 4 Nov 2024 10:09:00 +0000 Subject: [PATCH 1/3] fix: correct currency format for sats --- templates/tpos/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/tpos/index.html b/templates/tpos/index.html index e9dfbba..c23f3ba 100644 --- a/templates/tpos/index.html +++ b/templates/tpos/index.html @@ -1065,6 +1065,9 @@
itemFormatPrice(price, id) { const tpos = id.split(':')[0] const currency = _.findWhere(this.tposs, {id: tpos}).currency + if(currency == 'sats') { + return price + ' sats' + } return LNbits.utils.formatCurrency(Number(price).toFixed(2), currency) }, openItemDialog(id) { From 5d15db7799c938678039a26d26095f15c4e975b4 Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 4 Nov 2024 10:30:00 +0000 Subject: [PATCH 2/3] fix: correct sat amount output --- templates/tpos/tpos.html | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/tpos/tpos.html b/templates/tpos/tpos.html index 665965e..218c700 100644 --- a/templates/tpos/tpos.html +++ b/templates/tpos/tpos.html @@ -773,6 +773,7 @@
computed: { amount: function () { if (!this.stack.length) return 0.0 + if (this.currency == 'sats') return Number(this.stack.join("")) return ( this.stack.reduce((acc, dig) => acc * 10 + dig, 0) * (this.currency == 'sats' ? 1 : 0.01) From 4f613228d1696d9a257c2c4a9054c572dcf7091a Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Mon, 4 Nov 2024 10:53:39 +0000 Subject: [PATCH 3/3] fix: wait for exchange rate --- templates/tpos/tpos.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/templates/tpos/tpos.html b/templates/tpos/tpos.html index 218c700..e0da8d6 100644 --- a/templates/tpos/tpos.html +++ b/templates/tpos/tpos.html @@ -1247,11 +1247,13 @@
getRates() { if (this.currency == 'sats') { this.exchangeRate = 1 + this.$q.loading.hide() } else { LNbits.api .request('GET', `/tpos/api/v1/rate/${this.currency}`) .then(response => { this.exchangeRate = response.data.rate + this.$q.loading.hide() }) .catch(e => console.error(e)) } @@ -1322,9 +1324,9 @@
} } }, - created: function () { - var getRates = this.getRates - getRates() + created() { + this.$q.loading.show() + this.getRates() this.pinDisabled = JSON.parse('{{ tpos.withdrawpindisabled | tojson }}') this.tip_options = '{{ tpos.tip_options | tojson }}' == 'null' @@ -1389,8 +1391,8 @@
event.preventDefault() }) - setInterval(function () { - getRates() + setInterval(() => { + this.getRates() }, 120000) } })