refactor: replace var with const

This commit is contained in:
Vlad Stan 2022-07-06 16:39:23 +03:00
parent 50b2dcfcaa
commit 8e05a11978

View File

@ -287,7 +287,7 @@
<script> <script>
Vue.component(VueQrcode.name, VueQrcode) Vue.component(VueQrcode.name, VueQrcode)
var mapCharge = obj => { const mapCharge = obj => {
obj._data = _.clone(obj) obj._data = _.clone(obj)
obj.theTime = obj.time * 60 - (Date.now() / 1000 - obj.timestamp) obj.theTime = obj.time * 60 - (Date.now() / 1000 - obj.timestamp)
obj.time = obj.time + 'mins' obj.time = obj.time + 'mins'
@ -437,7 +437,6 @@
id: w.id, id: w.id,
label: w.title label: w.title
})) }))
} catch (error) { } catch (error) {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
} }
@ -447,12 +446,7 @@
is_unique: false is_unique: false
} }
}, },
openQrCodeDialog: function (linkId) {
var getAddresses = this.getAddresses
getAddresses(linkId)
this.current = linkId
this.Addresses.show = true
},
getCharges: async function () { getCharges: async function () {
try { try {
const {data} = await LNbits.api.request( const {data} = await LNbits.api.request(
@ -474,10 +468,10 @@
this.createCharge(wallet, data) this.createCharge(wallet, data)
}, },
timerCount: function () { timerCount: function () {
var refreshIntervalId = setInterval( () => { setInterval(async () => {
for (i = 0; i < this.ChargeLinks.length - 1; i++) { for (i = 0; i < this.ChargeLinks.length - 1; i++) {
if (this.ChargeLinks[i]['paid'] == 'True') { if (this.ChargeLinks[i]['paid'] == 'True') {
setTimeout(async function () { setTimeout(async () => {
await LNbits.api.request( await LNbits.api.request(
'GET', 'GET',
'/satspay/api/v1/charges/balance/' + '/satspay/api/v1/charges/balance/' +
@ -487,7 +481,7 @@
}, 2000) }, 2000)
} }
} }
this.getCharges() await this.getCharges()
}, 20000) }, 20000)
}, },
createCharge: async function (wallet, data) { createCharge: async function (wallet, data) {
@ -514,7 +508,7 @@
}, },
deleteChargeLink: function (chargeId) { deleteChargeLink: function (chargeId) {
var link = _.findWhere(this.ChargeLinks, {id: chargeId}) const link = _.findWhere(this.ChargeLinks, {id: chargeId})
LNbits.utils LNbits.utils
.confirmDialog('Are you sure you want to delete this pay link?') .confirmDialog('Are you sure you want to delete this pay link?')
.onOk(async () => { .onOk(async () => {
@ -537,14 +531,11 @@
LNbits.utils.exportCSV(this.ChargesTable.columns, this.ChargeLinks) LNbits.utils.exportCSV(this.ChargesTable.columns, this.ChargeLinks)
} }
}, },
created: function () { created: async function () {
console.log(this.g.user) console.log(this.g.user)
var getCharges = this.getCharges await this.getCharges()
getCharges() await this.getWalletLinks()
var getWalletLinks = this.getWalletLinks this.timerCount()
getWalletLinks()
var timerCount = this.timerCount
timerCount()
} }
}) })
</script> </script>