From 1857278dda6af72491b4ca34d6b5676f7b8eff6a Mon Sep 17 00:00:00 2001 From: Henrik Larsson Date: Fri, 7 Jul 2023 15:56:19 +0200 Subject: [PATCH] Update revalidate paths again --- app/api/revalidate/sanity/route.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/api/revalidate/sanity/route.ts b/app/api/revalidate/sanity/route.ts index d17e1d6f1..63146640a 100644 --- a/app/api/revalidate/sanity/route.ts +++ b/app/api/revalidate/sanity/route.ts @@ -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,22 +25,15 @@ export async function POST(request: NextRequest) { return; } - const slug: string = requestData.slug; - const type: string = requestData.type; - const locale: string = requestData.locale; + const slug = requestData.slug; + const type = requestData.type; if (type === 'home') { revalidatePath(`${slug}`) - console.log(`Revalidated path: ${slug}`); } else { - if (i18n.defaultLocale === locale) { - revalidatePath(`${slug}`) - console.log(`Revalidated path: ${slug}`); - } else { - revalidatePath(`${locale}${slug}`) - console.log(`Revalidated path: ${locale}${slug}`); - } + revalidatePath(`${slug}`) } + console.log(`Revalidated path: ${slug}`); return NextResponse.json({ revalidated: true, now: Date.now() }); } \ No newline at end of file