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
bacc407bc5
commit
ae90b68b04
@ -1,4 +1,5 @@
|
|||||||
import { isValidSignature, SIGNATURE_HEADER_NAME } from '@sanity/webhook';
|
import { isValidSignature, SIGNATURE_HEADER_NAME } from '@sanity/webhook';
|
||||||
|
import { i18n } from 'i18n-config';
|
||||||
import { revalidatePath } from 'next/cache';
|
import { revalidatePath } from 'next/cache';
|
||||||
import { headers } from 'next/headers';
|
import { headers } from 'next/headers';
|
||||||
import { NextRequest, NextResponse } from 'next/server';
|
import { NextRequest, NextResponse } from 'next/server';
|
||||||
@ -27,11 +28,16 @@ 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;
|
||||||
|
|
||||||
if (type === 'home') {
|
if (type === 'home') {
|
||||||
revalidatePath(`${slug}`)
|
revalidatePath(`${slug}`)
|
||||||
} else {
|
} else {
|
||||||
revalidatePath(`${slug}`)
|
if (i18n.defaultLocale === locale) {
|
||||||
|
revalidatePath(`${slug}`)
|
||||||
|
} else {
|
||||||
|
revalidatePath(`/${locale}${slug}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Revalidated path: ${slug}`);
|
console.log(`Revalidated path: ${slug}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user