Pass the ID of the guests that has just been invited
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 39s
Build Nginx-based docker image / build-static-assets (pull_request) Failing after 1m37s
Playwright Tests / test (pull_request) Successful in 3m56s

This commit is contained in:
Manuel Bustillo 2024-10-27 12:05:35 +01:00
parent ae7b338771
commit 45e2665997

View File

@ -27,8 +27,8 @@ export default function guestsTable() {
};
function handleInviteGuest() {
fetch("http://localhost:3001/guests/bulk-status-change.json", { method: 'POST', body: JSON.stringify({ status: "Invited", guest_ids: [] }) })
const handleInviteGuest = (e: React.MouseEvent<HTMLElement>) => {
fetch("http://localhost:3001/guests/bulk-status-change.json", { method: 'POST', body: JSON.stringify({ status: "Invited", guest_ids: [e.currentTarget.getAttribute('data-guest-id')] }) })
.then((response) => console.log(response.json()))
.catch((error) => console.error(error));
}
@ -91,7 +91,7 @@ export default function guestsTable() {
</span>
</td>
<td>
{guest.status === 'Considered' && (<button onClick={handleInviteGuest} className="bg-blue-300 hover:bg-blue-500 text-white py-1 px-2 rounded">
{guest.status === 'Considered' && (<button data-guest-id={guest.id} onClick={handleInviteGuest} className="bg-blue-300 hover:bg-blue-500 text-white py-1 px-2 rounded">
Invite
</button>)}
</td>