From 567ce207cf9028e6aff3ffc82357af0d08d987ff Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sat, 16 Nov 2024 00:45:45 +0100 Subject: [PATCH] Adapt the guests table to use the new API format --- app/lib/definitions.ts | 2 +- app/ui/guests/table.tsx | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/lib/definitions.ts b/app/lib/definitions.ts index 572914b..f1d3641 100644 --- a/app/lib/definitions.ts +++ b/app/lib/definitions.ts @@ -23,7 +23,7 @@ export type Guest = { name: string; group_name?: string; color?: string; - status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative'; + status?: 'considered' | 'invited' | 'confirmed' | 'declined' | 'tentative'; } export type Expense = { diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 6e8d5ad..6d93e3b 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -17,12 +17,12 @@ export default function guestsTable() { fetch("/api/guests.json") .then((response) => response.json()) .then((data) => { - setGuests(data.data.map((record: any) => { + setGuests(data.map((record: any) => { return ({ id: record.id, - name: record.attributes.name, - group_name: record.attributes.group_name, - status: record.attributes.status + name: record.name, + status: record.status, + group_name: record.group.name, }); })); }, (error) => { @@ -82,11 +82,11 @@ export default function guestsTable() { @@ -94,13 +94,13 @@ export default function guestsTable() { - {guest.status === 'Considered' && ()} - {(guest.status === 'Invited' || guest.status === 'Tentative') && ( + {(guest.status === 'invited' || guest.status === 'tentative') && ( <> - {guest.status != 'Tentative' && } + {guest.status != 'tentative' && } )}