mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
Rewrite res to response for convenience and clarity
This commit is contained in:
parent
e9afb63a52
commit
31ecadb97f
@ -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") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user