WIP make requests to the backend
This commit is contained in:
parent
a4edcbca07
commit
5918ce050c
@ -11,6 +11,13 @@ export function TableHeader() {
|
||||
|
||||
export default async function guestsTable() {
|
||||
|
||||
|
||||
function handleInviteGuest() {
|
||||
fetch("http://localhost:3001/guests/123.json", {method: 'PATCH', body: JSON.stringify({guest: {status: 'Invited'}})})
|
||||
.then((response) => console.log(response.json()))
|
||||
.catch((error) => console.error(error));
|
||||
}
|
||||
|
||||
let guests: Guest[] = await fetch("http://localhost:3001/guests.json")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
@ -81,7 +88,7 @@ export default async function guestsTable() {
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
{guest.status === 'Considered' && (<button className="bg-blue-300 hover:bg-blue-500 text-white py-1 px-2 rounded">
|
||||
{guest.status === 'Considered' && (<button 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