mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
19 lines
441 B
TypeScript
19 lines
441 B
TypeScript
import { getSortVariables } from './get-sort-variables'
|
|
import type { SearchProductsInput } from '../product/use-search'
|
|
|
|
export const getSearchVariables = ({
|
|
brandId,
|
|
search,
|
|
categoryId,
|
|
sort,
|
|
}: SearchProductsInput) => {
|
|
const sortBy = { direction: 'ASC', ...getSortVariables(sort, !!categoryId), channel: "default-channel"};
|
|
return {
|
|
categoryId,
|
|
filter: { search },
|
|
sortBy
|
|
}
|
|
}
|
|
|
|
export default getSearchVariables
|