From 31ecadb97fbe8150b71a892ab533ed1a454b6f47 Mon Sep 17 00:00:00 2001 From: Henrik Larsson Date: Mon, 3 Jul 2023 14:16:47 +0200 Subject: [PATCH] Rewrite res to response for convenience and clarity --- app/api/revalidate/sanity/route.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/revalidate/sanity/route.ts b/app/api/revalidate/sanity/route.ts index 6f6e2664e..d14c377a5 100644 --- a/app/api/revalidate/sanity/route.ts +++ b/app/api/revalidate/sanity/route.ts @@ -7,14 +7,14 @@ const SANITY_WEBHOOK_SECRET = `${process.env.SANITY_WEBHOOK_SECRET}`; export async function POST(request: NextRequest) { // Await the response from our request. - const res = await request.json(); + const response = await request.json(); // Get headers. const headersList = headers(); // Get Sanity webhook signature header name. const signature = `${headersList.get(SIGNATURE_HEADER_NAME)}`; - const isValid = isValidSignature(JSON.stringify(res), signature, SANITY_WEBHOOK_SECRET); + const isValid = isValidSignature(JSON.stringify(response), signature, SANITY_WEBHOOK_SECRET); // Log out validity of request. console.log(`===== Is the webhook request valid? ${isValid}`); @@ -25,9 +25,9 @@ export async function POST(request: NextRequest) { return; } - const slug = res.slug; - const locale = res.locale; - const type = res.type; + const slug = response.slug; + const locale = response.locale; + const type = response.type; let pathToRevalidate = ""; if (type === "home") {