feat: allow delete merchant from nostr

This commit is contained in:
Vlad Stan 2023-03-23 11:14:34 +02:00
parent 260bea9ccf
commit 05ecc65e5a
7 changed files with 141 additions and 11 deletions

View file

@ -15,7 +15,7 @@ async function merchantDetails(path) {
this.showKeys = !this.showKeys
this.$emit('show-keys', this.showKeys)
},
deleteMerchant: function () {
deleteMerchantTables: function () {
LNbits.utils
.confirmDialog(
`
@ -30,7 +30,6 @@ async function merchantDetails(path) {
'/nostrmarket/api/v1/merchant/' + this.merchantId,
this.adminkey
)
// todo: refresh parent page
this.$emit('merchant-deleted', this.merchantId)
this.$q.notify({
type: 'positive',
@ -42,6 +41,31 @@ async function merchantDetails(path) {
LNbits.utils.notifyApiError(error)
}
})
},
deleteMerchantFromNostr: function () {
LNbits.utils
.confirmDialog(
`
Do you want to remove the merchant from Nostr?
`
)
.onOk(async () => {
try {
await LNbits.api.request(
'DELETE',
`/nostrmarket/api/v1/merchant/${this.merchantId}/nostr`,
this.adminkey
)
this.$q.notify({
type: 'positive',
message: 'Merchant Deleted from Nostr',
timeout: 5000
})
} catch (error) {
console.warn(error)
LNbits.utils.notifyApiError(error)
}
})
}
},
created: async function () {}