diff --git a/app/api/guests.tsx b/app/api/guests.tsx index 6314338..4d91fac 100644 --- a/app/api/guests.tsx +++ b/app/api/guests.tsx @@ -21,7 +21,7 @@ export function loadGuests(onLoad?: (guests: Guest[]) => void) { }; export function updateGuest(guest: Guest) { - fetch(`/api/guests/${guest.id}`, + return fetch(`/api/guests/${guest.id}`, { method: 'PUT', body: JSON.stringify({ guest: { name: guest.name, status: guest.status } }), diff --git a/app/dashboard/guests/page.tsx b/app/dashboard/guests/page.tsx index d575715..fe46b0e 100644 --- a/app/dashboard/guests/page.tsx +++ b/app/dashboard/guests/page.tsx @@ -46,7 +46,7 @@ export default function Page() {
}> - +
diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 2e6dfae..143147b 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -9,10 +9,10 @@ import clsx from 'clsx'; import InlineTextField from '../components/form/inlineTextField'; import TableOfContents from '../components/table-of-contents'; -export default function guestsTable({ guests }: { guests: Guest[] }) { +export default function guestsTable({ guests, onUpdate }: { guests: Guest[], onUpdate: () => void }) { const handleGuestChange = (guest: Guest, status: GuestStatus) => { guest.status = status; - updateGuest(guest); + updateGuest(guest).then(() => onUpdate()); } return (