import { notFound } from "next/navigation";
import Contact from "@/app/(sidebar)/contacts/[contactId]/Contact";
import { fetchContact } from "@/app/(sidebar)/loaders";

export default async function ContactPage({
  params
}: {
  params: Promise<{ contactId: string }>
}) {
  const { contactId } = await params;
  const contact = fetchContact(contactId).then((c) => {
    if (c === null) notFound();
    return c;
  });

  return (
    <Contact contact={contact}/>
  );
}
