Fix Shopify translations issue

This commit is contained in:
cond0r
2021-05-22 09:28:00 +03:00
parent a4f56d1549
commit b4fb64a292
27 changed files with 211 additions and 133 deletions

View File

@@ -1,7 +1,9 @@
import { SWRHook } from '@commerce/utils/types'
import useSearch, { UseSearch } from '@commerce/product/use-search'
import { SearchProductsInput, SearchProductsData } from '@commerce/types'
import { ProductEdge } from '../schema'
import {
getAllProductsQuery,
getCollectionProductsQuery,
@@ -9,22 +11,8 @@ import {
normalizeProduct,
} from '../utils'
import { Product } from '@commerce/types'
export default useSearch as UseSearch<typeof handler>
export type SearchProductsInput = {
search?: string
categoryId?: string
brandId?: string
sort?: string
}
export type SearchProductsData = {
products: Product[]
found: boolean
}
export const handler: SWRHook<
SearchProductsData,
SearchProductsInput,
@@ -68,6 +56,7 @@ export const handler: SWRHook<
['categoryId', input.categoryId],
['brandId', input.brandId],
['sort', input.sort],
['locale', input.locale],
],
swrOptions: {
revalidateOnFocus: false,