Files
stripstream-librarian/apps/backoffice/app/api/libraries/[id]/metadata-provider/route.ts
Froidefond Julien 5ba4315e98
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 42s
fix: revalidate /libraries cache after settings updates
Add revalidatePath("/libraries") to the monitoring, metadata-provider
and reading-status-provider route handlers so that saving library
settings invalidates the Next.js data cache and the page reflects
fresh data on reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 12:51:16 +01:00

23 lines
749 B
TypeScript

import { revalidatePath } from "next/cache";
import { NextRequest, NextResponse } from "next/server";
import { apiFetch, LibraryDto } from "@/lib/api";
export async function PATCH(
request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
try {
const body = await request.json();
const data = await apiFetch<LibraryDto>(`/libraries/${id}/metadata-provider`, {
method: "PATCH",
body: JSON.stringify(body),
});
revalidatePath("/libraries");
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to update metadata provider";
return NextResponse.json({ error: message }, { status: 500 });
}
}