mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
turns out the if statements here are necesary
This commit is contained in:
@@ -12,10 +12,11 @@ export const handler: SWRHook<SearchProductsHook> = {
|
|||||||
// Use a dummy base as we only care about the relative path
|
// Use a dummy base as we only care about the relative path
|
||||||
const url = new URL(options.url!, 'http://a')
|
const url = new URL(options.url!, 'http://a')
|
||||||
|
|
||||||
url.searchParams.set('search', String(search))
|
|
||||||
url.searchParams.set('categoryId', String(categoryId))
|
if (search) url.searchParams.set('search', String(search))
|
||||||
url.searchParams.set('brandId', String(brandId))
|
if (categoryId) url.searchParams.set('categoryId', String(categoryId))
|
||||||
url.searchParams.set('sort', String(sort))
|
if (brandId) url.searchParams.set('brandId', String(brandId))
|
||||||
|
if (sort) url.searchParams.set('sort', String(sort))
|
||||||
|
|
||||||
return fetch({
|
return fetch({
|
||||||
url: url.pathname + url.search,
|
url: url.pathname + url.search,
|
||||||
|
Reference in New Issue
Block a user