mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 21:21:21 +00:00
Update use-search.tsx
This commit is contained in:
parent
3236de1b4c
commit
65d1d45ee0
@ -37,7 +37,7 @@ export const handler: SWRHook<
|
|||||||
const { categoryId, brandId } = input
|
const { categoryId, brandId } = input
|
||||||
|
|
||||||
const data = await fetch({
|
const data = await fetch({
|
||||||
query: categoryId ? getCollectionProductsQuery : options?.query,
|
query: categoryId ? getCollectionProductsQuery : options.query,
|
||||||
method: options?.method,
|
method: options?.method,
|
||||||
variables: getSearchVariables(input),
|
variables: getSearchVariables(input),
|
||||||
})
|
})
|
||||||
@ -56,10 +56,8 @@ export const handler: SWRHook<
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
products: edges?.map(({ node }: ProductEdge) =>
|
products: edges.map(({ node }: ProductEdge) => normalizeProduct(node)),
|
||||||
normalizeProduct(node as any)
|
found: !!edges.length,
|
||||||
),
|
|
||||||
found: !!edges?.length,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
useHook: ({ useData }) => (input = {}) => {
|
useHook: ({ useData }) => (input = {}) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user