mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 14:06:59 +00:00
Update revalidate paths again
This commit is contained in:
parent
218abc1d10
commit
b03940bb0b
@ -4,7 +4,7 @@ import { headers } from 'next/headers';
|
|||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
|
|
||||||
const SANITY_WEBHOOK_SECRET = `${process.env.SANITY_WEBHOOK_SECRET}`;
|
const SANITY_WEBHOOK_SECRET = `${process.env.SANITY_WEBHOOK_SECRET}`;
|
||||||
|
export const runtime = 'edge'
|
||||||
export async function POST(request: NextRequest) {
|
export async function POST(request: NextRequest) {
|
||||||
// Await the response from our request.
|
// Await the response from our request.
|
||||||
const requestData = await request.json();
|
const requestData = await request.json();
|
||||||
@ -31,9 +31,9 @@ export async function POST(request: NextRequest) {
|
|||||||
let pathToRevalidate = "";
|
let pathToRevalidate = "";
|
||||||
|
|
||||||
if (type === "home") {
|
if (type === "home") {
|
||||||
pathToRevalidate = `${slug}${locale}`
|
pathToRevalidate = `${slug}`
|
||||||
} else {
|
} else {
|
||||||
pathToRevalidate = `${locale}${slug}`
|
pathToRevalidate = `/${locale}${slug}`
|
||||||
}
|
}
|
||||||
|
|
||||||
revalidatePath(pathToRevalidate);
|
revalidatePath(pathToRevalidate);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user