Added support for deleting all cache data

This commit is contained in:
Umar Adilov 2025-05-10 18:14:48 +05:00
parent edb39d5538
commit 537ed60fa8

View File

@ -1,16 +1,14 @@
import { revalidateTag } from 'next/cache';
import { revalidatePath } from 'next/cache';
import { NextResponse } from 'next/server';
import { FetchTags } from '@/shared/api/tags';
export async function GET() {
try {
revalidateTag(FetchTags.TAYLOR);
revalidatePath('*'); // Drop all cache
return NextResponse.json({ success: true });
} catch (err) {
return NextResponse.json(
{ error: 'Failed to revalidate', detail: err },
{ error: 'Failed to drop cache', detail: err },
{ status: 500 },
);
}