import { prisma } from "@/lib/prisma";
import { BlogForm } from "@/components/dashboard/blog/BlogForm";
import { notFound } from "next/navigation";

export const dynamic = "force-dynamic";

export default async function EditBlogPage({ 
  params 
}: { 
  params: Promise<{ id: string }> 
}) {
  const { id } = await params;
  const blog = await prisma.blog.findUnique({
    where: { id },
    include: { tags: true },
  });

  if (!blog) notFound();

  return (
    <div className="p-6">
      <BlogForm initialData={blog} />
    </div>
  );
}
