Edit Contact but without loading?

This commit is contained in:
2025-04-01 17:14:43 +02:00
parent a4536d20b4
commit aa81948f29
6 changed files with 97 additions and 7 deletions

View File

@@ -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<ContactRecord>
}) {
const c = use(contact);
const router = useRouter();
return (
<div id="contact">
@@ -47,9 +49,12 @@ export default function Contact({
{c.notes ? <p>{c.notes}</p> : null}
<div>
<Form action="edit">
<button type="submit">Edit</button>
</Form>
<button
type="button"
onClick={() => router.push(`/contacts/${c.id}/edit`)}
>
Edit
</button>
<Form
action="destroy"