Fix stale social media preview: revalidate next-event fetch, reject past featured events

Made-with: Cursor
This commit is contained in:
Michilis
2026-03-07 19:36:12 +00:00
parent 25b7018743
commit 596ec71191
3 changed files with 14 additions and 2 deletions

View File

@@ -38,8 +38,10 @@ interface NextEvent {
async function getNextUpcomingEvent(): Promise<NextEvent | null> {
try {
const revalidateSeconds =
parseInt(process.env.NEXT_EVENT_REVALIDATE_SECONDS || '3600', 10) || 3600;
const response = await fetch(`${apiUrl}/api/events/next/upcoming`, {
next: { tags: ['next-event'] },
next: { tags: ['next-event'], revalidate: revalidateSeconds },
});
if (!response.ok) return null;
const data = await response.json();