We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bec884 commit e7e3e2aCopy full SHA for e7e3e2a
app/api/torch-webhook/route.ts
@@ -0,0 +1,20 @@
1
+import { revalidatePath } from "next/cache"
2
+import { NextRequest, NextResponse } from "next/server"
3
+
4
+export async function POST(req: NextRequest) {
5
+ const body = await req.json()
6
7
+ console.log("Torch webhook", body)
8
9
+ const webhookId = body.webhookId
10
11
+ if (webhookId !== Number(process.env.TORCH_WEBHOOK_ID)) {
12
+ return NextResponse.json({ message: "Invalid webhook ID" }, { status: 401 })
13
+ }
14
15
+ // revalidate the 10 years page
16
+ revalidatePath("/10years")
17
+ console.log("Revalidated 10 years page")
18
19
+ return NextResponse.json({ message: "OK" })
20
+}
0 commit comments