refactor: a wallet is a wallet is a wallet

This commit is contained in:
Eneko Illarramendi
2020-03-31 19:05:25 +02:00
parent 75d97ddfc1
commit d03785558b
15 changed files with 207 additions and 167 deletions
+16 -16
View File
@@ -160,6 +160,7 @@ new Vue({
: false;
},
paymentsFiltered: function () {
return this.payments;
return this.payments.filter(function (obj) {
return obj.isPaid;
});
@@ -222,7 +223,7 @@ new Vue({
self.receive.paymentReq = response.data.payment_request;
self.receive.paymentChecker = setInterval(function () {
LNbits.api.getPayment(self.w.wallet, response.data.payment_hash).then(function (response) {
LNbits.api.getPayment(self.w.wallet, response.data.checking_id).then(function (response) {
if (response.data.paid) {
self.fetchPayments();
self.receive.show = false;
@@ -284,20 +285,21 @@ new Vue({
icon: null
});
LNbits.api.payInvoice(this.w.wallet, this.send.data.bolt11).catch(function (error) {
LNbits.api.payInvoice(this.w.wallet, this.send.data.bolt11).then(function (response) {
self.send.paymentChecker = setInterval(function () {
LNbits.api.getPayment(self.w.wallet, response.data.checking_id).then(function (res) {
if (res.data.paid) {
self.send.show = false;
clearInterval(self.send.paymentChecker);
dismissPaymentMsg();
self.fetchPayments();
}
});
}, 2000);
}).catch(function (error) {
dismissPaymentMsg();
LNbits.utils.notifyApiError(error);
});
self.send.paymentChecker = setInterval(function () {
LNbits.api.getPayment(self.w.wallet, self.send.invoice.hash).then(function (response) {
if (response.data.paid) {
self.send.show = false;
clearInterval(self.send.paymentChecker);
dismissPaymentMsg();
self.fetchPayments();
}
});
}, 2000);
},
deleteWallet: function (walletId, user) {
LNbits.href.deleteWallet(walletId, user);
@@ -327,8 +329,6 @@ new Vue({
},
created: function () {
this.fetchPayments();
setTimeout(function () {
this.checkPendingPayments();
}, 1100);
setTimeout(this.checkPendingPayments(), 1200);
}
});