Files
KabundiNjuki ff743a1397 Initial commit
2026-10-05 16:40:36 +03:00

14 lines
575 B
TypeScript

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() })
}