Skip to content

Commit b86fba2

Browse files
Fix errors (#108)
* fix: correct currency format for sats * fix: correct sat amount output * fix: wait for exchange rate
1 parent a117a58 commit b86fba2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

templates/tpos/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,9 @@ <h6 class="text-subtitle1 q-my-none">
10651065
itemFormatPrice(price, id) {
10661066
const tpos = id.split(':')[0]
10671067
const currency = _.findWhere(this.tposs, {id: tpos}).currency
1068+
if(currency == 'sats') {
1069+
return price + ' sats'
1070+
}
10681071
return LNbits.utils.formatCurrency(Number(price).toFixed(2), currency)
10691072
},
10701073
openItemDialog(id) {

templates/tpos/tpos.html

+8-5
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ <h5 class="q-mt-none q-mb-sm">
773773
computed: {
774774
amount: function () {
775775
if (!this.stack.length) return 0.0
776+
if (this.currency == 'sats') return Number(this.stack.join(""))
776777
return (
777778
this.stack.reduce((acc, dig) => acc * 10 + dig, 0) *
778779
(this.currency == 'sats' ? 1 : 0.01)
@@ -1246,11 +1247,13 @@ <h5 class="q-mt-none q-mb-sm">
12461247
getRates() {
12471248
if (this.currency == 'sats') {
12481249
this.exchangeRate = 1
1250+
this.$q.loading.hide()
12491251
} else {
12501252
LNbits.api
12511253
.request('GET', `/tpos/api/v1/rate/${this.currency}`)
12521254
.then(response => {
12531255
this.exchangeRate = response.data.rate
1256+
this.$q.loading.hide()
12541257
})
12551258
.catch(e => console.error(e))
12561259
}
@@ -1321,9 +1324,9 @@ <h5 class="q-mt-none q-mb-sm">
13211324
}
13221325
}
13231326
},
1324-
created: function () {
1325-
var getRates = this.getRates
1326-
getRates()
1327+
created() {
1328+
this.$q.loading.show()
1329+
this.getRates()
13271330
this.pinDisabled = JSON.parse('{{ tpos.withdrawpindisabled | tojson }}')
13281331
this.tip_options =
13291332
'{{ tpos.tip_options | tojson }}' == 'null'
@@ -1388,8 +1391,8 @@ <h5 class="q-mt-none q-mb-sm">
13881391
event.preventDefault()
13891392
})
13901393

1391-
setInterval(function () {
1392-
getRates()
1394+
setInterval(() => {
1395+
this.getRates()
13931396
}, 120000)
13941397
}
13951398
})

0 commit comments

Comments
 (0)