2024-06-19 16:01:42 +00:00
|
|
|
"use server"
|
2024-06-19 17:46:30 +00:00
|
|
|
import { revalidatePath } from "next/cache";
|
2024-06-19 16:01:42 +00:00
|
|
|
import prisma from "./db";
|
2024-06-19 17:46:30 +00:00
|
|
|
import { redirect } from "next/navigation";
|
2024-06-19 16:01:42 +00:00
|
|
|
|
2024-06-19 17:46:30 +00:00
|
|
|
export async function deleteStory(id: number) {
|
2024-06-19 16:01:42 +00:00
|
|
|
const res = await prisma.story.delete({
|
|
|
|
where: { id }
|
|
|
|
})
|
2024-06-19 17:46:30 +00:00
|
|
|
console.log(`deleted: ${res}`)
|
|
|
|
revalidatePath("/story")
|
|
|
|
redirect("/story")
|
2024-06-19 16:01:42 +00:00
|
|
|
}
|
2024-06-20 08:35:25 +00:00
|
|
|
export async function deletePub(id: number) {
|
|
|
|
const res = await prisma.pub.delete({
|
|
|
|
where: { id }
|
|
|
|
})
|
|
|
|
console.log(`deleted: ${res}`)
|
|
|
|
revalidatePath("/publication")
|
|
|
|
redirect("/publication")
|
|
|
|
}
|