Type fixes

This commit is contained in:
Luis Alvarez
2020-10-19 12:40:26 -05:00
parent a3e021ec79
commit 9309bff517
5 changed files with 24 additions and 27 deletions

View File

@@ -43,11 +43,13 @@ export const getAllProductsQuery = /* GraphQL */ `
${productConnectionFragment}
`
export type Product = NonNullable<
export type ProductEdge = NonNullable<
NonNullable<GetAllProductsQuery['site']['products']['edges']>[0]
>
export type Products = Product[]
export type Product = ProductEdge
export type Products = ProductEdge[]
export type GetAllProductsResult<
T extends Record<keyof GetAllProductsResult, any[]> = { products: Products }

View File

@@ -6,7 +6,7 @@ export default async function fetchGraphqlApi<Q, V = any>(
query: string,
{ variables, preview }: CommerceAPIFetchOptions<V> = {}
): Promise<Q> {
log.warn(query)
// log.warn(query)
const config = getConfig()
const res = await fetch(config.commerceUrl + (preview ? '/preview' : ''), {
method: 'POST',