Update revalidate paths again

This commit is contained in:
Henrik Larsson 2023-07-07 14:43:54 +02:00
parent 9f23f9aadc
commit 554068a425

View File

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