From 12349aa344a348bb20cff62ebd55663db192447e Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 18 Jul 2023 11:08:48 +0300 Subject: [PATCH] fix: navigation link --- static/js/market.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/static/js/market.js b/static/js/market.js index ffab43e..55e0218 100644 --- a/static/js/market.js +++ b/static/js/market.js @@ -541,14 +541,12 @@ const market = async () => { }, navigateTo(page, opts = { stall: null, product: null, pubkey: null }) { console.log("### navigateTo", page, opts) - let { stall, product, pubkey } = opts - let url = new URL(window.location) - if (pubkey) url.searchParams.set('merchant', pubkey) - if (stall && !pubkey) { - pubkey = this.stalls.find(s => s.id == stall).pubkey - url.searchParams.set('merchant', pubkey) - } + const { stall, product, pubkey } = opts + const url = new URL(window.location) + + const merchantPubkey = pubkey || this.stalls.find(s => s.id == stall)?.pubkey + url.searchParams.set('merchant', merchantPubkey) if (page === 'stall' || page === 'product') { if (stall) { @@ -559,6 +557,8 @@ const market = async () => { this.activeProduct = product if (product) { url.searchParams.set('product', product) + } else { + url.searchParams.delete('product') } } } else {