From d24ed528791a1d8fb5bdb8ebabe9996b901fac5c Mon Sep 17 00:00:00 2001 From: Tiago Vasconcelos Date: Wed, 15 Mar 2023 11:19:49 +0000 Subject: [PATCH] fix search error --- static/js/market.js | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/static/js/market.js b/static/js/market.js index ea7b4c8..80063b6 100644 --- a/static/js/market.js +++ b/static/js/market.js @@ -196,6 +196,12 @@ const market = async () => { return }, async updateData(events) { + if (events.length < 1) { + this.$q.notify({ + message: 'No matches were found!' + }) + return + } let products = new Map() let stalls = new Map() @@ -215,15 +221,21 @@ const market = async () => { this.stalls = await Array.from(stalls.values()) - this.products = Array.from(products.values()).map(obj => { - let stall = this.stalls.find(s => s.id == obj.stall_id) - obj.stallName = stall.name - obj.images = [obj.image] - if (obj.currency != 'sat') { - obj.formatedPrice = this.getAmountFormated(obj.price, obj.currency) - } - return obj - }) + this.products = Array.from(products.values()) + .map(obj => { + let stall = this.stalls.find(s => s.id == obj.stall_id) + if (!stall) return + obj.stallName = stall.name + obj.images = [obj.image] + if (obj.currency != 'sat') { + obj.formatedPrice = this.getAmountFormated( + obj.price, + obj.currency + ) + } + return obj + }) + .filter(f => f) }, async initNostr() { this.$q.loading.show()