mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 21:51:21 +00:00
fix: client/server pecularities for env visibility
Must prefix with `NEXT_PUBLIC_` so that the API URL is visible on the client
This commit is contained in:
parent
bbbe270842
commit
65df8036ae
@ -18,6 +18,8 @@ function getProviderName() {
|
||||
? 'shopify'
|
||||
: process.env.NEXT_PUBLIC_SWELL_STORE_ID
|
||||
? 'swell'
|
||||
: process.env.NEXT_PUBLIC_SALEOR_API_URL
|
||||
? 'saleor'
|
||||
: null)
|
||||
)
|
||||
}
|
||||
|
@ -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: {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user