import { notFound } from "next/navigation";
import { getRow } from "@/lib/data";
import { TABLES } from "@/lib/appwrite-server";
import type { BlogPostRow } from "@/lib/types";
import { BlogForm } from "../../form";

export default async function EditBlogPage({
  params,
}: {
  params: Promise<{ id: string }>;
}) {
  const { id } = await params;
  const post = await getRow<BlogPostRow>(TABLES.blogPosts, id);
  if (!post) notFound();
  return <BlogForm post={post} />;
}
