refactor: clean-up unnecessary self

This commit is contained in:
Vlad Stan 2022-07-06 16:19:33 +03:00
parent 6cfa8e30bc
commit 50b2dcfcaa

View file

@ -416,15 +416,14 @@
},
methods: {
cancelCharge: function (data) {
var self = this
self.formDialogCharge.data.description = ''
self.formDialogCharge.data.onchainwallet = ''
self.formDialogCharge.data.lnbitswallet = ''
self.formDialogCharge.data.time = null
self.formDialogCharge.data.amount = null
self.formDialogCharge.data.webhook = ''
self.formDialogCharge.data.completelink = ''
self.formDialogCharge.show = false
this.formDialogCharge.data.description = ''
this.formDialogCharge.data.onchainwallet = ''
this.formDialogCharge.data.lnbitswallet = ''
this.formDialogCharge.data.time = null
this.formDialogCharge.data.amount = null
this.formDialogCharge.data.webhook = ''
this.formDialogCharge.data.completelink = ''
this.formDialogCharge.show = false
},
getWalletLinks: async function () {
@ -449,11 +448,10 @@
}
},
openQrCodeDialog: function (linkId) {
var self = this
var getAddresses = this.getAddresses
getAddresses(linkId)
self.current = linkId
self.Addresses.show = true
this.current = linkId
this.Addresses.show = true
},
getCharges: async function () {
try {
@ -468,30 +466,28 @@
}
},
sendFormDataCharge: function () {
var self = this
var wallet = this.g.user.wallets[0].inkey
var data = this.formDialogCharge.data
const wallet = this.g.user.wallets[0].inkey
const data = this.formDialogCharge.data
data.amount = parseInt(data.amount)
data.time = parseInt(data.time)
data.onchainwallet = this.onchainwallet?.id
this.createCharge(wallet, data)
},
timerCount: function () {
self = this
var refreshIntervalId = setInterval(function () {
for (i = 0; i < self.ChargeLinks.length - 1; i++) {
if (self.ChargeLinks[i]['paid'] == 'True') {
var refreshIntervalId = setInterval( () => {
for (i = 0; i < this.ChargeLinks.length - 1; i++) {
if (this.ChargeLinks[i]['paid'] == 'True') {
setTimeout(async function () {
await LNbits.api.request(
'GET',
'/satspay/api/v1/charges/balance/' +
self.ChargeLinks[i]['id'],
this.ChargeLinks[i]['id'],
'filla'
)
}, 2000)
}
}
self.getCharges()
this.getCharges()
}, 20000)
},
createCharge: async function (wallet, data) {
@ -518,19 +514,18 @@
},
deleteChargeLink: function (chargeId) {
var self = this
var link = _.findWhere(this.ChargeLinks, {id: chargeId})
LNbits.utils
.confirmDialog('Are you sure you want to delete this pay link?')
.onOk(async function () {
.onOk(async () => {
try {
const response = await LNbits.api.request(
'DELETE',
'/satspay/api/v1/charge/' + chargeId,
self.g.user.wallets[0].adminkey
this.g.user.wallets[0].adminkey
)
self.ChargeLinks = _.reject(self.ChargeLinks, function (obj) {
this.ChargeLinks = _.reject(this.ChargeLinks, function (obj) {
return obj.id === chargeId
})
} catch (error) {
@ -544,7 +539,6 @@
},
created: function () {
console.log(this.g.user)
var self = this
var getCharges = this.getCharges
getCharges()
var getWalletLinks = this.getWalletLinks