feat: refresh merchant from nostr (#85)

This commit is contained in:
Vlad Stan 2023-09-20 12:06:36 +03:00 committed by GitHub
parent 656723ed5e
commit 2dc5c5479f
6 changed files with 55 additions and 5 deletions

View file

@ -24,6 +24,14 @@
>
</q-item-section>
</q-item>
<q-item @click="requeryMerchantData" clickable v-close-popup>
<q-item-section>
<q-item-label>Refresh from Nostr</q-item-label>
<q-item-label caption
>Requery all stalls, products and orders from Nostr</q-item-label
>
</q-item-section>
</q-item>
<q-item @click="republishMerchantData" clickable v-close-popup>
<q-item-section>
<q-item-label>Republish to Nostr</q-item-label>
@ -32,6 +40,7 @@
>
</q-item-section>
</q-item>
<q-item @click="deleteMerchantTables" clickable v-close-popup>
<q-item-section>
<q-item-label>Delete from DB</q-item-label>

View file

@ -33,6 +33,23 @@ async function merchantDetails(path) {
LNbits.utils.notifyApiError(error)
}
},
requeryMerchantData: async function () {
try {
await LNbits.api.request(
'GET',
`/nostrmarket/api/v1/merchant/${this.merchantId}/nostr`,
this.adminkey
)
this.$q.notify({
type: 'positive',
message: 'Merchant data refreshed from Nostr',
timeout: 5000
})
} catch (error) {
console.warn(error)
LNbits.utils.notifyApiError(error)
}
},
deleteMerchantTables: function () {
LNbits.utils
.confirmDialog(

View file

@ -15,7 +15,7 @@
<div class="col-md-4 col-sm-6">
<q-btn-dropdown @click="getOrders()" :disable="search.restoring" outline unelevated split
class="q-pt-md float-right" :label="search.restoring ? 'Restoring Orders...' : 'Search Orders'">
class="q-pt-md float-right" :label="search.restoring ? 'Restoring Orders...' : 'Load Orders'">
<q-spinner v-if="search.restoring" color="primary" size="2.55em" class="q-pt-md float-right"></q-spinner>
<q-item @click="restoreOrders" clickable v-close-popup>
<q-item-section>