diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index 1684e7a..5be00bf 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -307,7 +307,11 @@ new Vue({ }); }, deleteWallet: function (walletId, user) { - LNbits.href.deleteWallet(walletId, user); + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this wallet?' + ).onOk(function () { + LNbits.href.deleteWallet(walletId, user); + }); }, fetchPayments: function (checkPending) { var self = this; diff --git a/lnbits/extensions/amilk/templates/amilk/index.html b/lnbits/extensions/amilk/templates/amilk/index.html index 9640f19..4166efd 100644 --- a/lnbits/extensions/amilk/templates/amilk/index.html +++ b/lnbits/extensions/amilk/templates/amilk/index.html @@ -202,17 +202,9 @@ var self = this; var amilk = _.findWhere(this.amilks, {id: amilkId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this AMilk link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this AMilk link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/amilk/api/v1/amilks/' + amilkId, diff --git a/lnbits/extensions/diagonalley/templates/diagonalley/index.html b/lnbits/extensions/diagonalley/templates/diagonalley/index.html index 287a509..bf11641 100644 --- a/lnbits/extensions/diagonalley/templates/diagonalley/index.html +++ b/lnbits/extensions/diagonalley/templates/diagonalley/index.html @@ -474,17 +474,9 @@ var self = this; var indexer = _.findWhere(this.indexers, {id: indexerId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this Indexer link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this Indexer link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/diagonalley/api/v1/diagonalley/indexers/' + indexerId, @@ -538,17 +530,9 @@ var self = this; var order = _.findWhere(this.orders, {id: orderId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this order link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this order link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/diagonalley/api/v1/diagonalley/orders/' + orderId, @@ -646,17 +630,9 @@ var self = this; var product = _.findWhere(this.products, {id: productId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this products link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this products link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/diagonalley/api/v1/diagonalley/products/' + productId, diff --git a/lnbits/extensions/paywall/templates/paywall/index.html b/lnbits/extensions/paywall/templates/paywall/index.html index 75af210..e4c774d 100644 --- a/lnbits/extensions/paywall/templates/paywall/index.html +++ b/lnbits/extensions/paywall/templates/paywall/index.html @@ -186,17 +186,9 @@ var self = this; var paywall = _.findWhere(this.paywalls, {id: paywallId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this paywall link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this paywall link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/paywall/api/v1/paywalls/' + paywallId, diff --git a/lnbits/extensions/tpos/templates/tpos/index.html b/lnbits/extensions/tpos/templates/tpos/index.html index 393723c..b5a55db 100644 --- a/lnbits/extensions/tpos/templates/tpos/index.html +++ b/lnbits/extensions/tpos/templates/tpos/index.html @@ -193,17 +193,9 @@ var self = this; var tpos = _.findWhere(this.tposs, {id: tposId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this TPoS?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this TPoS?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/tpos/api/v1/tposs/' + tposId, diff --git a/lnbits/extensions/withdraw/static/js/index.js b/lnbits/extensions/withdraw/static/js/index.js index 288bfc1..c2d9fef 100644 --- a/lnbits/extensions/withdraw/static/js/index.js +++ b/lnbits/extensions/withdraw/static/js/index.js @@ -131,17 +131,9 @@ new Vue({ var self = this; var link = _.findWhere(this.withdrawLinks, {id: linkId}); - this.$q.dialog({ - message: 'Are you sure you want to delete this withdraw link?', - ok: { - flat: true, - color: 'orange' - }, - cancel: { - flat: true, - color: 'grey' - } - }).onOk(function () { + LNbits.utils.confirmDialog( + 'Are you sure you want to delete this withdraw link?' + ).onOk(function () { LNbits.api.request( 'DELETE', '/withdraw/api/v1/links/' + linkId, diff --git a/lnbits/static/js/base.js b/lnbits/static/js/base.js index 3e49caa..4bc2c09 100644 --- a/lnbits/static/js/base.js +++ b/lnbits/static/js/base.js @@ -87,6 +87,19 @@ var LNbits = { } }, utils: { + confirmDialog: function (msg) { + return Quasar.plugins.Dialog.create({ + message: msg, + ok: { + flat: true, + color: 'orange' + }, + cancel: { + flat: true, + color: 'grey' + } + }); + }, formatCurrency: function (value, currency) { return new Intl.NumberFormat(LOCALE, {style: 'currency', currency: currency}).format(value); },