update product search hook. whitelist cdn

This commit is contained in:
Greg Hoskin
2021-03-29 17:49:14 -06:00
parent e4c1050880
commit 1ebf458fb2
8 changed files with 31 additions and 56 deletions

View File

@@ -21,16 +21,8 @@ const getAllProducts = async (options: {
}): Promise<ReturnType> => {
let { config, variables = { first: 250 } } = options ?? {}
config = getConfig(config)
const { data }: GraphQLFetcherResult = await config.fetch(
getAllProductsQuery,
{ variables }
)
const products =
data.products?.edges?.map(({ node: p }: ProductEdge) =>
normalizeProduct(p)
) ?? []
const { results } = await config.fetchSwell('products', 'get')
const products = results.map((product) => normalizeProduct(product)) ?? []
return {
products,