import { NextResponse } from 'next/server' import { revalidatePath } from 'next/cache' // Called by the Frappe backend after race data changes, so the site updates at once // instead of within the 60-second refresh window. export async function POST(req: Request) { const secret = process.env.REVALIDATE_SECRET if (!secret || req.headers.get('x-revalidate-secret') !== secret) { return NextResponse.json({ error: 'Not allowed.' }, { status: 401 }) } revalidatePath('/', 'layout') return NextResponse.json({ revalidated: true, at: new Date().toISOString() }) }