Test revalidate route

This commit is contained in:
Henrik Larsson 2023-05-16 14:46:23 +02:00
parent 9b749fde40
commit eed1b6b5e7

View File

@ -2,10 +2,12 @@ import { revalidatePath } from 'next/cache';
import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) {
const path = request.nextUrl.searchParams.get('path') || '/';
const { searchParams } = new URL(request.url);
const slug = searchParams.get('slug');
const locale = searchParams.get('locale');
console.log(request.nextUrl.searchParams)
revalidatePath(path);
revalidatePath(`/${locale}/${slug}`);
return NextResponse.json({ revalidated: true, now: Date.now() });
}