Skip to content

Commit

Permalink
fix currency errors on v1
Browse files Browse the repository at this point in the history
  • Loading branch information
talvasconcelos committed Nov 13, 2024
1 parent 4a26f33 commit c07cc32
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/js/tpos.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ window.app = Vue.createApp({
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)
Expand Down Expand Up @@ -619,11 +620,13 @@ window.app = Vue.createApp({
getRates() {
if (this.currency == 'sats') {
this.exchangeRate = 1
Quasar.Loading.hide()
} else {
LNbits.api
.request('GET', `/tpos/api/v1/rate/${this.currency}`)
.then(response => {
this.exchangeRate = response.data.rate
Quasar.Loading.hide()
})
.catch(e => console.error(e))
}
Expand Down Expand Up @@ -692,6 +695,7 @@ window.app = Vue.createApp({
}
},
created() {
Quasar.Loading.show()
this.tposId = tpos.id
this.currency = tpos.currency
this.atmPremium = tpos.withdraw_premium / 100
Expand Down

0 comments on commit c07cc32

Please sign in to comment.