From 08442fe3066fcb0dbc1d2060cc2df2a5c2a0cec9 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Thu, 17 Oct 2024 10:00:22 +0530 Subject: [PATCH] Do not cache the produts page and revalidate the instagram every 30 minutes --- src/app/(storefront)/products/page.tsx | 1 + src/lib/instagram.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/(storefront)/products/page.tsx b/src/app/(storefront)/products/page.tsx index 9aa8539..fc5ee79 100644 --- a/src/app/(storefront)/products/page.tsx +++ b/src/app/(storefront)/products/page.tsx @@ -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) { diff --git a/src/lib/instagram.ts b/src/lib/instagram.ts index d7639fb..297dd82 100644 --- a/src/lib/instagram.ts +++ b/src/lib/instagram.ts @@ -13,7 +13,7 @@ export async function fetchInstagramPosts(): Promise { // 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) {