diff --git a/src/app/(sidebar)/contacts/[contactId]/Contact.tsx b/src/app/(sidebar)/contacts/[contactId]/Contact.tsx index e54c418..edd5764 100644 --- a/src/app/(sidebar)/contacts/[contactId]/Contact.tsx +++ b/src/app/(sidebar)/contacts/[contactId]/Contact.tsx @@ -3,6 +3,7 @@ import { ContactRecord } from "@/app/data"; import Form from "next/form"; import { use } from "react"; +import { useRouter } from "next/navigation"; export default function Contact({ contact @@ -10,6 +11,7 @@ export default function Contact({ contact: Promise }) { const c = use(contact); + const router = useRouter(); return (
@@ -47,9 +49,12 @@ export default function Contact({ {c.notes ?

{c.notes}

: null}
-
- -
+
Loading Edit Contact...
+ ); +} \ No newline at end of file diff --git a/src/app/(sidebar)/contacts/[contactId]/edit/page.tsx b/src/app/(sidebar)/contacts/[contactId]/edit/page.tsx new file mode 100644 index 0000000..ce2068c --- /dev/null +++ b/src/app/(sidebar)/contacts/[contactId]/edit/page.tsx @@ -0,0 +1,69 @@ +import Form from "next/form"; +import { fetchContact } from "@/app/(sidebar)/loaders"; +import { notFound } from "next/navigation"; + + +export default async function EditContactPage({ + params +}: { + params: Promise<{ contactId: string }> +}) { + const { contactId } = await params; + const contact = await fetchContact(contactId).then((c) => { + if (c === null) notFound(); + return c; + }); + + return ( + +

+ Name + + +

+ + +