feat: republish to nostr

This commit is contained in:
Vlad Stan 2023-03-24 14:52:34 +02:00
parent 5694c4112f
commit 13150f6360
4 changed files with 65 additions and 36 deletions

View file

@ -15,30 +15,23 @@ async function merchantDetails(path) {
this.showKeys = !this.showKeys
this.$emit('show-keys', this.showKeys)
},
republishMerchantData: function () {
LNbits.utils
.confirmDialog(
`You are about to republish to Nostr`
republishMerchantData: async function () {
try {
await LNbits.api.request(
'PUT',
`/nostrmarket/api/v1/merchant/${this.merchantId}/nostr`,
this.adminkey
)
.onOk(async () => {
try {
await LNbits.api.request(
'PATCH',
`/nostrmarket/api/v1/merchant/${this.merchantId}/nostr`,
this.adminkey
)
this.$emit('merchant-deleted', this.merchantId)
this.$q.notify({
type: 'positive',
message: 'Merchant Deleted',
timeout: 5000
})
} catch (error) {
console.warn(error)
LNbits.utils.notifyApiError(error)
}
this.$q.notify({
type: 'positive',
message: 'Merchant data republished to Nostr',
timeout: 5000
})
} catch (error) {
console.warn(error)
LNbits.utils.notifyApiError(error)
}
},
deleteMerchantTables: function () {
LNbits.utils