Added support for deleting all cache data
This commit is contained in:
parent
edb39d5538
commit
537ed60fa8
@ -1,16 +1,14 @@
|
|||||||
import { revalidateTag } from 'next/cache';
|
import { revalidatePath } from 'next/cache';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
import { FetchTags } from '@/shared/api/tags';
|
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
try {
|
try {
|
||||||
revalidateTag(FetchTags.TAYLOR);
|
revalidatePath('*'); // Drop all cache
|
||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{ error: 'Failed to revalidate', detail: err },
|
{ error: 'Failed to drop cache', detail: err },
|
||||||
{ status: 500 },
|
{ status: 500 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user