fix: navigation link

This commit is contained in:
Vlad Stan 2023-07-18 11:08:48 +03:00
parent 2518715110
commit 12349aa344

View file

@ -541,14 +541,12 @@ const market = async () => {
}, },
navigateTo(page, opts = { stall: null, product: null, pubkey: null }) { navigateTo(page, opts = { stall: null, product: null, pubkey: null }) {
console.log("### navigateTo", page, opts) console.log("### navigateTo", page, opts)
let { stall, product, pubkey } = opts
let url = new URL(window.location)
if (pubkey) url.searchParams.set('merchant', pubkey) const { stall, product, pubkey } = opts
if (stall && !pubkey) { const url = new URL(window.location)
pubkey = this.stalls.find(s => s.id == stall).pubkey
url.searchParams.set('merchant', pubkey) const merchantPubkey = pubkey || this.stalls.find(s => s.id == stall)?.pubkey
} url.searchParams.set('merchant', merchantPubkey)
if (page === 'stall' || page === 'product') { if (page === 'stall' || page === 'product') {
if (stall) { if (stall) {
@ -559,6 +557,8 @@ const market = async () => {
this.activeProduct = product this.activeProduct = product
if (product) { if (product) {
url.searchParams.set('product', product) url.searchParams.set('product', product)
} else {
url.searchParams.delete('product')
} }
} }
} else { } else {