mirror of
https://github.com/vercel/commerce.git
synced 2025-07-04 04:01:21 +00:00
Search products by name
This commit is contained in:
parent
a86bcd1d98
commit
c173b47ac9
@ -31,14 +31,12 @@ export const handler: SWRHook<SearchProductsHook> = {
|
||||
|
||||
const taxons = [input.categoryId, input.brandId].filter(Boolean)
|
||||
|
||||
const filter =
|
||||
taxons.length > 0
|
||||
? {
|
||||
filter: {
|
||||
taxons: taxons.join(','),
|
||||
},
|
||||
}
|
||||
: {}
|
||||
const filter = {
|
||||
filter: {
|
||||
...(taxons.length > 0 ? { taxons: taxons.join(',') } : {}),
|
||||
...(input.search ? { name: input.search } : {}),
|
||||
},
|
||||
}
|
||||
|
||||
const sort = input.sort ? { sort: nextToSpreeSortMap[input.sort] } : {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user