mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 22:16:58 +00:00
Update revalidate paths again
This commit is contained in:
parent
fcacaf189a
commit
bacc407bc5
@ -27,17 +27,13 @@ export async function POST(request: NextRequest) {
|
|||||||
|
|
||||||
const slug = requestData.slug;
|
const slug = requestData.slug;
|
||||||
const type = requestData.type;
|
const type = requestData.type;
|
||||||
const locale = requestData.locale;
|
|
||||||
let pathToRevalidate = "";
|
|
||||||
|
|
||||||
if (type === 'home') {
|
if (type === 'home') {
|
||||||
pathToRevalidate = slug;
|
revalidatePath(`${slug}`)
|
||||||
} else {
|
} else {
|
||||||
pathToRevalidate = locale + slug;
|
revalidatePath(`${slug}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
revalidatePath(pathToRevalidate);
|
console.log(`Revalidated path: ${slug}`);
|
||||||
|
|
||||||
console.log(`Revalidated path: ${pathToRevalidate}`);
|
|
||||||
return NextResponse.json({ revalidated: true, now: Date.now() });
|
return NextResponse.json({ revalidated: true, now: Date.now() });
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user