Aligned with upstream changes

This commit is contained in:
cond0r
2021-02-25 09:55:02 +02:00
parent d83367f257
commit f242f3c588
17 changed files with 77 additions and 47 deletions

View File

@@ -1,10 +1,19 @@
import { Product } from '@commerce/types'
import { getConfig, ShopifyConfig } from '../api'
import fetchAllProducts from '../api/utils/fetch-all-products'
import { ProductEdge } from '../schema'
import getAllProductsPathsQuery from '../utils/queries/get-all-products-paths-query'
type ProductPath = {
path: string
}
export type ProductPathNode = {
node: ProductPath
}
type ReturnType = {
products: any[]
products: ProductPathNode[]
}
const getAllProductPaths = async (options?: {

View File

@@ -1,10 +1,9 @@
import { GraphQLFetcherResult } from '@commerce/api'
import { getConfig, ShopifyConfig } from '../api'
import { Product, ProductEdge } from '../schema'
import { ProductEdge } from '../schema'
import { getAllProductsQuery } from '../utils/queries'
import { normalizeProduct } from '@framework/utils/normalize'
export type ProductNode = Product
import { Product } from '@commerce/types'
type Variables = {
first?: number
@@ -12,7 +11,7 @@ type Variables = {
}
type ReturnType = {
products: any[]
products: Product[]
}
const getAllProducts = async (options: {
@@ -28,9 +27,10 @@ const getAllProducts = async (options: {
{ variables }
)
const products = data.products?.edges?.map(({ node: p }: ProductEdge) =>
normalizeProduct(p)
)
const products =
data.products?.edges?.map(({ node: p }: ProductEdge) =>
normalizeProduct(p)
) ?? []
return {
products,

View File

@@ -1,2 +1,2 @@
export * from '@commerce/use-price'
export { default } from '@commerce/use-price'
export * from '@commerce/product/use-price'
export { default } from '@commerce/product/use-price'