From cf9b341dc9ab25a53ffc64938d047763913070d8 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Tue, 25 May 2021 17:00:54 -0500 Subject: [PATCH] Fixes --- framework/bigcommerce/api/utils/fetch-graphql-api.ts | 2 +- framework/bigcommerce/api/utils/fetch-store-api.ts | 3 +-- framework/commerce/api/operations.ts | 11 ++++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/framework/bigcommerce/api/utils/fetch-graphql-api.ts b/framework/bigcommerce/api/utils/fetch-graphql-api.ts index 9c2eaa2ac..7dc39f987 100644 --- a/framework/bigcommerce/api/utils/fetch-graphql-api.ts +++ b/framework/bigcommerce/api/utils/fetch-graphql-api.ts @@ -3,13 +3,13 @@ import type { GraphQLFetcher } from '@commerce/api' import { provider } from '..' import fetch from './fetch' -const { config } = provider const fetchGraphqlApi: GraphQLFetcher = async ( query: string, { variables, preview } = {}, fetchOptions ) => { // log.warn(query) + const { config } = provider const res = await fetch(config.commerceUrl + (preview ? '/preview' : ''), { ...fetchOptions, method: 'POST', diff --git a/framework/bigcommerce/api/utils/fetch-store-api.ts b/framework/bigcommerce/api/utils/fetch-store-api.ts index 68817417e..a00b3777a 100644 --- a/framework/bigcommerce/api/utils/fetch-store-api.ts +++ b/framework/bigcommerce/api/utils/fetch-store-api.ts @@ -3,12 +3,11 @@ import { provider } from '..' import { BigcommerceApiError, BigcommerceNetworkError } from './errors' import fetch from './fetch' -const { config } = provider - export default async function fetchStoreApi( endpoint: string, options?: RequestInit ): Promise { + const { config } = provider let res: Response try { diff --git a/framework/commerce/api/operations.ts b/framework/commerce/api/operations.ts index aa30f426e..2910a2d82 100644 --- a/framework/commerce/api/operations.ts +++ b/framework/commerce/api/operations.ts @@ -14,7 +14,16 @@ const noop = () => { throw new Error('Not implemented') } -export const OPERATIONS = ['login'] as const +export const OPERATIONS = [ + 'login', + 'getAllPages', + 'getPage', + 'getSiteInfo', + 'getCustomerWishlist', + 'getAllProductPaths', + 'getAllProducts', + 'getProduct', +] as const export const defaultOperations = OPERATIONS.reduce((ops, k) => { ops[k] = noop