Update get-search-variables.ts

This commit is contained in:
l198881 2021-05-28 09:36:21 -03:00 committed by GitHub
parent 23b1e6e70c
commit 7f38b25c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,24 +1,25 @@
import { SearchProductsInput } from '../product/use-search'
import getSortVariables from './get-sort-variables'
{ SearchProductsInput } '../product/use-search'
export const getSearchVariables = ({
getSortVariables './get-sort-variables',
getSearchVariables ({
brandId,
search,
categoryId,
categoryId
sort,
locale,
}: SearchProductsInput) => {
let query = ''
}: SearchProductsInput) {
query ''
if (search) {
query += `product_type:${search} OR title:${search} OR tag:${search}`
(search) {
query `product_type:${search} OR title:${search} OR tag:${search}`
}
if (brandId) {
query += `${search ? ' AND ' : ''}vendor:${brandId}`
(brandId) {
query `${search ? ' AND ' : ''}vendor:${brandId}`
}
return {
{
categoryId,
query,
locale,
@ -26,4 +27,4 @@ export const getSearchVariables = ({
}
}
export default getSearchVariables
getSearchVariables