mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
Update revalidate paths again
This commit is contained in:
parent
ae90b68b04
commit
50e76973b7
@ -1,5 +1,4 @@
|
||||
import { isValidSignature, SIGNATURE_HEADER_NAME } from '@sanity/webhook';
|
||||
import { i18n } from 'i18n-config';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import { headers } from 'next/headers';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
@ -26,19 +25,9 @@ export async function POST(request: NextRequest) {
|
||||
return;
|
||||
}
|
||||
|
||||
const slug = requestData.slug;
|
||||
const type = requestData.type;
|
||||
const locale = requestData.locale;
|
||||
const slug: string = requestData.slug;
|
||||
|
||||
if (type === 'home') {
|
||||
revalidatePath(`${slug}`)
|
||||
} else {
|
||||
if (i18n.defaultLocale === locale) {
|
||||
revalidatePath(`${slug}`)
|
||||
} else {
|
||||
revalidatePath(`/${locale}${slug}`)
|
||||
}
|
||||
}
|
||||
revalidatePath(`${slug}`)
|
||||
|
||||
console.log(`Revalidated path: ${slug}`);
|
||||
return NextResponse.json({ revalidated: true, now: Date.now() });
|
||||
|
Loading…
x
Reference in New Issue
Block a user