Files
Epicnabbo-Catalogus-Updated…/src/actions/admin-photos.ts
T
2026-07-13 21:57:41 +02:00

20 lines
470 B
TypeScript

"use server";
import { revalidatePath } from "next/cache";
import { requireStaff } from "@/lib/admin/guard";
import { prisma } from "@/lib/prisma";
export async function deletePhoto(formData: FormData): Promise<void> {
await requireStaff();
const id = Number(formData.get("id"));
if (!(id > 0)) return;
try {
await prisma.cameraWeb.delete({ where: { id } });
} catch {
// Record may have already been removed; ignore.
}
revalidatePath("/admin/photos");
}