From fa375a23b4c4232926a71f0d7a276a547939b350 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Thu, 13 Jul 2023 14:45:06 +0300 Subject: [PATCH] chore: small stuff --- static/js/market.js | 23 ++++++++++++++--------- templates/nostrmarket/market.html | 8 +++++--- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/static/js/market.js b/static/js/market.js index 0e224a8..dae9c76 100644 --- a/static/js/market.js +++ b/static/js/market.js @@ -7,7 +7,8 @@ const market = async () => { 'wss://relay.damus.io', 'wss://relay.snort.social', 'wss://nostr-pub.wellorder.net', - 'wss://nostr.zebedee.cloud' + 'wss://nostr.zebedee.cloud', + 'wss://nostr.walletofsatoshi.com' ] const eventToObj = event => { event.content = JSON.parse(event.content) || null @@ -764,15 +765,15 @@ const market = async () => { }, handlePaymentRequest(json) { - if (!json.payment_options?.length) { - this.qrCodeDialog.data.message = json.message || 'Unexpected error' - console.log('### qrCodeDialog.data.message', this.qrCodeDialog.data.message) - return - } if (json.id && (json.id !== this.activeOrderId)) { // not for active order, store somewehre else return } + if (!json.payment_options?.length) { + this.qrCodeDialog.data.message = json.message || 'Unexpected error' + return + } + const paymentRequest = json.payment_options.find(o => o.type == 'ln') .link if (!paymentRequest) return @@ -785,6 +786,10 @@ const market = async () => { }, handleOrderStatusUpdate(jsonData) { + if (jsonData.id && (jsonData.id !== this.activeOrderId)) { + // not for active order, store somewehre else + return + } if (this.qrCodeDialog.dismissMsg) { this.qrCodeDialog.dismissMsg() } @@ -819,7 +824,7 @@ const market = async () => { console.log('### persistOrderUpdate', pubkey, eventCreatedAt, orderUpdate) let orders = this.$q.localStorage.getItem(`nostrmarket.orders.${pubkey}`) || [] const orderIndex = orders.findIndex(o => o.id === orderUpdate.id) - + if (orderIndex === -1) { orders.unshift({ ...orderUpdate, @@ -827,7 +832,7 @@ const market = async () => { createdAt: eventCreatedAt }) this.orders[pubkey] = orders - this.orders = {...this.orders} + this.orders = { ...this.orders } this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders) return } @@ -844,7 +849,7 @@ const market = async () => { // orders = [order].concat(orders.filter(o => o.id !== order.id)) orders.splice(orderIndex, 1, order) this.orders[pubkey] = orders - this.orders = {...this.orders} + this.orders = { ...this.orders } this.$q.localStorage.set(`nostrmarket.orders.${pubkey}`, orders) }, diff --git a/templates/nostrmarket/market.html b/templates/nostrmarket/market.html index 48bfc7d..1c9592b 100644 --- a/templates/nostrmarket/market.html +++ b/templates/nostrmarket/market.html @@ -161,7 +161,7 @@
- + - +
Search @@ -181,7 +181,9 @@ User Config - Chat + Orders