mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
15 lines
458 B
JavaScript
15 lines
458 B
JavaScript
import { revalidateTimestampPage } from '../revalidate'
|
|
|
|
export async function POST(/** @type {Request} */ request) {
|
|
// we can't call revalidatePath from middleware, so we need to do it from here instead
|
|
const path = new URL(request.url).searchParams.get('path')
|
|
if (!path) {
|
|
return Response.json(
|
|
{ message: 'Missing "path" search param' },
|
|
{ status: 400 }
|
|
)
|
|
}
|
|
await revalidateTimestampPage(path)
|
|
return Response.json({})
|
|
}
|