Pass the ID of the guests that has just been invited
This commit is contained in:
parent
ae7b338771
commit
45e2665997
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user