fix older tpos without tips (#778)

This commit is contained in:
Tiago Vasconcelos 2022-07-25 11:52:28 +01:00 committed by GitHub
parent 7fbea79e62
commit 27b4db9877
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,7 +169,9 @@
<h5 class="q-mt-none"> <h5 class="q-mt-none">
{% raw %}{{ fsat }} {% raw %}{{ fsat }}
<small>sat</small> <small>sat</small>
<span style="font-size: 0.75rem">( + {{ tipAmountSat }} tip)</span> <span v-show="tip_options" style="font-size: 0.75rem"
>( + {{ tipAmountSat }} tip)</span
>
{% endraw %} {% endraw %}
</h5> </h5>
</div> </div>
@ -275,7 +277,7 @@
return { return {
tposId: '{{ tpos.id }}', tposId: '{{ tpos.id }}',
currency: '{{ tpos.currency }}', currency: '{{ tpos.currency }}',
tip_options: JSON.parse('{{ tpos.tip_options }}'), tip_options: null,
exchangeRate: null, exchangeRate: null,
stack: [], stack: [],
tipAmount: 0.0, tipAmount: 0.0,
@ -352,7 +354,7 @@
this.showInvoice() this.showInvoice()
}, },
submitForm: function () { submitForm: function () {
if (this.tip_options.length) { if (this.tip_options) {
this.showTipModal() this.showTipModal()
} else { } else {
this.showInvoice() this.showInvoice()
@ -417,6 +419,11 @@
created: function () { created: function () {
var getRates = this.getRates var getRates = this.getRates
getRates() getRates()
this.tip_options =
'{{ tpos.tip_options | tojson }}' == 'null'
? null
: JSON.parse('{{ tpos.tip_options }}')
console.log(typeof this.tip_options, this.tip_options)
setInterval(function () { setInterval(function () {
getRates() getRates()
}, 20000) }, 20000)