fix: remove products when merchant is removed
This commit is contained in:
parent
99a98f0df9
commit
58d7fc647c
2 changed files with 10 additions and 7 deletions
|
|
@ -19,8 +19,8 @@
|
||||||
<q-card-section class="q-py-sm">
|
<q-card-section class="q-py-sm">
|
||||||
<div>
|
<div>
|
||||||
<span v-if="product.currency == 'sat'">
|
<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 /
|
<span class="text-h6">{{ product.price }} sats</span><q-tooltip> BTC {{ (product.price /
|
||||||
1e8).toFixed(8) }}</span>
|
1e8).toFixed(8) }}</q-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<span class="text-h6">{{ product.formatedPrice }}</span>
|
<span class="text-h6">{{ product.formatedPrice }}</span>
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ const market = async () => {
|
||||||
computed: {
|
computed: {
|
||||||
filterProducts() {
|
filterProducts() {
|
||||||
let products = this.products
|
let products = this.products
|
||||||
|
console.log('### this.products', this.products)
|
||||||
if (this.activeStall) {
|
if (this.activeStall) {
|
||||||
products = products.filter(p => p.stall_id == this.activeStall)
|
products = products.filter(p => p.stall_id == this.activeStall)
|
||||||
}
|
}
|
||||||
|
|
@ -341,10 +342,10 @@ const market = async () => {
|
||||||
return
|
return
|
||||||
} else if (e.kind == 30018) {
|
} else if (e.kind == 30018) {
|
||||||
//it's a product `d` is the prod. id
|
//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) {
|
} else if (e.kind == 30017) {
|
||||||
// it's a stall `d` is the stall id
|
// 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 })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -536,9 +537,9 @@ const market = async () => {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
addMerchant(publicKey){
|
addMerchant(publicKey) {
|
||||||
console.log('### addMerchat', publicKey)
|
console.log('### addMerchat', publicKey)
|
||||||
|
|
||||||
this.merchants.unshift({
|
this.merchants.unshift({
|
||||||
publicKey,
|
publicKey,
|
||||||
profile: null
|
profile: null
|
||||||
|
|
@ -546,10 +547,12 @@ const market = async () => {
|
||||||
this.$q.localStorage.set('nostrmarket.merchants', this.merchants)
|
this.$q.localStorage.set('nostrmarket.merchants', this.merchants)
|
||||||
this.initNostr() // todo: improve
|
this.initNostr() // todo: improve
|
||||||
},
|
},
|
||||||
removeMerchant(publicKey){
|
removeMerchant(publicKey) {
|
||||||
console.log('### removeMerchat', publicKey)
|
console.log('### removeMerchat', publicKey)
|
||||||
this.merchants = this.merchants.filter(m => m.publicKey !== publicKey)
|
this.merchants = this.merchants.filter(m => m.publicKey !== publicKey)
|
||||||
this.$q.localStorage.set('nostrmarket.merchants', this.merchants)
|
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
|
this.initNostr() // todo: improve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue