From 50e76973b74b0906d577ca7d2075e8b82363167d Mon Sep 17 00:00:00 2001 From: Henrik Larsson Date: Fri, 7 Jul 2023 15:50:12 +0200 Subject: [PATCH] Update revalidate paths again --- app/api/revalidate/sanity/route.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/app/api/revalidate/sanity/route.ts b/app/api/revalidate/sanity/route.ts index 5a20096d9..6e6b80457 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,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() });