fix: remove revalidate from cart requests

This commit is contained in:
Victor Gerbrands 2023-05-11 16:36:48 +02:00
parent cd2db81bbb
commit 46395206b6
3 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import { notFound } from 'next/navigation';
export const runtime = 'edge';
export const revalidate = 43200; // 12 hours in seconds
export const revalidate = parseInt(process.env.REVALIDATE_WINDOW ?? `${60 * 60 * 12}`); // 12 hours
export async function generateMetadata({
params

View File

@ -6,7 +6,6 @@ import Grid from 'components/grid';
import ProductGridItems from 'components/layout/product-grid-items';
export const runtime = 'edge';
export const revalidate = 30;
export async function generateMetadata({
params

View File

@ -33,10 +33,13 @@ export default async function medusaRequest(
headers: {
'Content-Type': 'application/json',
'x-publishable-key': MEDUSA_API_KEY
},
next: { revalidate: REVALIDATE_WINDOW }
}
};
if (!path.includes('/carts')) {
options.next = { revalidate: REVALIDATE_WINDOW };
}
if (payload) {
options.body = JSON.stringify(payload);
}