feat: part: republish to nostr

This commit is contained in:
Vlad Stan 2023-03-23 14:33:05 +02:00
parent 05ecc65e5a
commit ccb32dba99
3 changed files with 35 additions and 3 deletions

View file

@ -24,9 +24,17 @@
> >
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item @click="republishMerchantData" disable clickable v-close-popup>
<q-item-section>
<q-item-label>Republish to Nostr</q-item-label>
<q-item-label caption
>Republish all stalls, products and orders to Nostr</q-item-label
>
</q-item-section>
</q-item>
<q-item @click="deleteMerchantTables" clickable v-close-popup> <q-item @click="deleteMerchantTables" clickable v-close-popup>
<q-item-section> <q-item-section>
<q-item-label>Delete Merchant from DB</q-item-label> <q-item-label>Delete from DB</q-item-label>
<q-item-label caption <q-item-label caption
>Delete all stalls, products and orders from database</q-item-label >Delete all stalls, products and orders from database</q-item-label
> >
@ -34,7 +42,7 @@
</q-item> </q-item>
<q-item @click="deleteMerchantFromNostr" clickable v-close-popup> <q-item @click="deleteMerchantFromNostr" clickable v-close-popup>
<q-item-section> <q-item-section>
<q-item-label>Delete Merchant from Nostr</q-item-label> <q-item-label>Delete from Nostr</q-item-label>
<q-item-label caption <q-item-label caption
>Delete all stalls, products and orders from Nostr</q-item-label >Delete all stalls, products and orders from Nostr</q-item-label
> >

View file

@ -15,6 +15,31 @@ async function merchantDetails(path) {
this.showKeys = !this.showKeys this.showKeys = !this.showKeys
this.$emit('show-keys', this.showKeys) this.$emit('show-keys', this.showKeys)
}, },
republishMerchantData: function () {
LNbits.utils
.confirmDialog(
`You are about to republish to Nostr`
)
.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)
}
})
},
deleteMerchantTables: function () { deleteMerchantTables: function () {
LNbits.utils LNbits.utils
.confirmDialog( .confirmDialog(

View file

@ -153,7 +153,6 @@ async def api_delete_merchant(
merchant_id: str, merchant_id: str,
wallet: WalletTypeInfo = Depends(require_admin_key), wallet: WalletTypeInfo = Depends(require_admin_key),
): ):
try: try:
merchant = await get_merchant_for_user(wallet.wallet.user) merchant = await get_merchant_for_user(wallet.wallet.user)
assert merchant, "Merchant cannot be found" assert merchant, "Merchant cannot be found"