Search products by name

This commit is contained in:
tniezg 2021-07-28 16:58:35 +02:00
parent a86bcd1d98
commit c173b47ac9

View File

@ -31,14 +31,12 @@ export const handler: SWRHook<SearchProductsHook> = {
const taxons = [input.categoryId, input.brandId].filter(Boolean) const taxons = [input.categoryId, input.brandId].filter(Boolean)
const filter = const filter = {
taxons.length > 0
? {
filter: { filter: {
taxons: taxons.join(','), ...(taxons.length > 0 ? { taxons: taxons.join(',') } : {}),
...(input.search ? { name: input.search } : {}),
}, },
} }
: {}
const sort = input.sort ? { sort: nextToSpreeSortMap[input.sort] } : {} const sort = input.sort ? { sort: nextToSpreeSortMap[input.sort] } : {}