Update revalidate paths again

This commit is contained in:
Henrik Larsson 2023-07-07 14:49:22 +02:00
parent 554068a425
commit 419e4a6958

View File

@ -1,5 +1,4 @@
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,8 +26,7 @@ export async function POST(request: NextRequest) {
} }
const slug = requestData.slug; const slug = requestData.slug;
const locale = requestData.locale; const pathToRevalidate = slug;
const pathToRevalidate = i18n.defaultLocale === locale ? slug : `/${locale}${slug}`;
revalidatePath(pathToRevalidate); revalidatePath(pathToRevalidate);