mirror of
https://github.com/vercel/commerce.git
synced 2025-05-20 08:26:59 +00:00
fix: add backend url fallback
This commit is contained in:
parent
c90b2664b7
commit
b6cf1704ae
@ -1,6 +1,6 @@
|
||||
TWITTER_CREATOR="@medusajs"
|
||||
TWITTER_SITE="https://medusajs.com/"
|
||||
SITE_NAME="Next.js Commerce by Medusa"
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_API="http://localhost:9000/store"
|
||||
NEXT_PUBLIC_MEDUSA_BACKEND_API="http://localhost:9000"
|
||||
NEXT_PUBLIC_VERCEL_URL="http://localhost:3000"
|
||||
MEDUSA_API_KEY=""
|
@ -19,7 +19,7 @@ import {
|
||||
SelectedOption
|
||||
} from './types';
|
||||
|
||||
const ENDPOINT = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_API;
|
||||
const ENDPOINT = process.env.NEXT_PUBLIC_MEDUSA_BACKEND_API ?? 'http://localhost:9000';
|
||||
const MEDUSA_API_KEY = process.env.MEDUSA_API_KEY ?? '';
|
||||
const REVALIDATE_WINDOW = parseInt(process.env.REVALIDATE_WINDOW ?? `${60 * 15}`); // 15 minutes
|
||||
|
||||
@ -45,7 +45,7 @@ export default async function medusaRequest(
|
||||
}
|
||||
|
||||
try {
|
||||
const result = await fetch(`${ENDPOINT}${path}`, options);
|
||||
const result = await fetch(`${ENDPOINT}/store${path}`, options);
|
||||
|
||||
const body = await result.json();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user