diff --git a/framework/commerce/config.js b/framework/commerce/config.js index 0e962e2ef..9e9799528 100644 --- a/framework/commerce/config.js +++ b/framework/commerce/config.js @@ -18,6 +18,8 @@ function getProviderName() { ? 'shopify' : process.env.NEXT_PUBLIC_SWELL_STORE_ID ? 'swell' + : process.env.NEXT_PUBLIC_SALEOR_API_URL + ? 'saleor' : null) ) } diff --git a/framework/saleor/api/utils/fetch-graphql-api.ts b/framework/saleor/api/utils/fetch-graphql-api.ts index dfbcf0343..53675f766 100644 --- a/framework/saleor/api/utils/fetch-graphql-api.ts +++ b/framework/saleor/api/utils/fetch-graphql-api.ts @@ -3,13 +3,17 @@ import fetch from './fetch' import { API_URL } from '../../const' import { getError } from '../../utils/handle-fetch-response' +import { getConfig } from '..' const fetchGraphqlApi: GraphQLFetcher = async ( query: string, { variables } = {}, fetchOptions ) => { - const res = await fetch(API_URL, { + // FIXME @zaiste follow the bigcommerce example + const config = getConfig() + + const res = await fetch(API_URL || '', { ...fetchOptions, method: 'POST', headers: { diff --git a/framework/saleor/const.ts b/framework/saleor/const.ts index dea284d7f..506fccf8d 100644 --- a/framework/saleor/const.ts +++ b/framework/saleor/const.ts @@ -1,3 +1,2 @@ -export const API_URL = process.env.NEXT_SALEOR_API_URL - -export const API_CHANNEL = process.env.NEXT_SALEOR_CHANNEL +export const API_URL = process.env.NEXT_PUBLIC_SALEOR_API_URL +export const API_CHANNEL = process.env.NEXT_PUBLIC_SALEOR_CHANNEL