31 lines
712 B
TypeScript
31 lines
712 B
TypeScript
"use server"
|
|
import { revalidatePath } from "next/cache";
|
|
import prisma from "./db";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export async function deleteStory(id: number) {
|
|
const res = await prisma.story.delete({
|
|
where: { id }
|
|
})
|
|
console.log(`deleted: ${res}`)
|
|
revalidatePath("/story")
|
|
redirect("/story")
|
|
}
|
|
export async function deletePub(id: number) {
|
|
const res = await prisma.pub.delete({
|
|
where: { id }
|
|
})
|
|
console.log(`deleted: ${res}`)
|
|
revalidatePath("/publication")
|
|
redirect("/publication")
|
|
}
|
|
|
|
export async function deleteSub(id: number) {
|
|
const res = await prisma.sub.delete({
|
|
where: { id }
|
|
})
|
|
console.log(`deleted: ${res}`)
|
|
revalidatePath("/submission")
|
|
redirect("/submission")
|
|
}
|