Do not cache the produts page and revalidate the instagram every 30 minutes

This commit is contained in:
Amritanshu Agrawal 2024-10-17 10:00:22 +05:30
parent acaacfd83a
commit 08442fe306
2 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ async function fetchProducts() {
'Content-Type': 'application/json',
'x-publishable-api-key': process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY as string,
},
next: { revalidate: 0 },
});
if (!response.ok) {

View File

@ -13,7 +13,7 @@ export async function fetchInstagramPosts(): Promise<InstagramPost[]> {
// const url = `https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,thumbnail_url,permalink&access_token=${accessToken}`;
const url = `https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,thumbnail_url,permalink&access_token=${accessToken}`;
const res = await fetch(url);
const res = await fetch(url, { next: { revalidate: 30 * 60 } });
const data = await res.json();
if (data?.data) {