Updated useSearch hook

This commit is contained in:
Luis Alvarez
2021-05-25 14:53:17 -05:00
parent f8d69323bd
commit 0e6372cf54
4 changed files with 28 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
import { SWRHook } from '@commerce/utils/types'
import useSearch, { UseSearch } from '@commerce/product/use-search'
import type { SearchProductsData } from '../api/catalog/products'
import type { SearchProductsHook } from '../types/product'
export default useSearch as UseSearch<typeof handler>
@@ -11,13 +11,9 @@ export type SearchProductsInput = {
sort?: string
}
export const handler: SWRHook<
SearchProductsData,
SearchProductsInput,
SearchProductsInput
> = {
export const handler: SWRHook<SearchProductsHook> = {
fetchOptions: {
url: '/api/bigcommerce/catalog/products',
url: '/api/catalog/products',
method: 'GET',
},
fetcher({ input: { search, categoryId, brandId, sort }, options, fetch }) {