fix: remove products when merchant is removed

This commit is contained in:
Vlad Stan 2023-07-06 12:55:11 +03:00
parent 99a98f0df9
commit 58d7fc647c
2 changed files with 10 additions and 7 deletions

View file

@ -19,8 +19,8 @@
<q-card-section class="q-py-sm">
<div>
<span v-if="product.currency == 'sat'">
<span class="text-h6">{{ product.price }} sats</span><span class="q-ml-sm text-grey-6">BTC {{ (product.price /
1e8).toFixed(8) }}</span>
<span class="text-h6">{{ product.price }} sats</span><q-tooltip> BTC {{ (product.price /
1e8).toFixed(8) }}</q-tooltip>
</span>
<span v-else>
<span class="text-h6">{{ product.formatedPrice }}</span>

View file

@ -86,6 +86,7 @@ const market = async () => {
computed: {
filterProducts() {
let products = this.products
console.log('### this.products', this.products)
if (this.activeStall) {
products = products.filter(p => p.stall_id == this.activeStall)
}
@ -341,10 +342,10 @@ const market = async () => {
return
} else if (e.kind == 30018) {
//it's a product `d` is the prod. id
products.set(e.d, { ...e.content, id: e.d, categories: e.t })
products.set(e.d, { ...e.content, pubkey: e.pubkey, id: e.d, categories: e.t })
} else if (e.kind == 30017) {
// it's a stall `d` is the stall id
stalls.set(e.d, { ...e.content, id: e.d, pubkey: e.pubkey })
stalls.set(e.d, { ...e.content, pubkey: e.pubkey, id: e.d, pubkey: e.pubkey })
}
})
@ -550,6 +551,8 @@ const market = async () => {
console.log('### removeMerchat', publicKey)
this.merchants = this.merchants.filter(m => m.publicKey !== publicKey)
this.$q.localStorage.set('nostrmarket.merchants', this.merchants)
this.products = this.products.filter(p => p.pubkey !== publicKey)
this.stalls = this.stalls.filter(p => p.pubkey !== publicKey)
this.initNostr() // todo: improve
}
}