{post.title}
{/* Author Information */}by{" "} {post.author?.name || "Anonymous"}
{/* Content Section */}{post.content}
) : (No content available for this post.
)}export const dynamic = "force-dynamic"; // This disables SSG and ISR import prisma from "@/lib/prisma"; import { notFound, redirect } from "next/navigation"; export default async function Post({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; const postId = parseInt(id); const post = await prisma.post.findUnique({ where: { id: postId }, include: { author: true, }, }); if (!post) { notFound(); } // Server action to delete the post async function deletePost() { "use server"; await prisma.post.delete({ where: { id: postId, }, }); redirect("/posts"); } return (
by{" "} {post.author?.name || "Anonymous"}
{/* Content Section */}{post.content}
) : (No content available for this post.
)}