WIP make requests to the backend
All checks were successful
Playwright Tests / test (pull_request) Successful in 1m59s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 3m34s

This commit is contained in:
Manuel Bustillo 2024-10-27 11:33:40 +01:00
parent a4edcbca07
commit 5918ce050c

View File

@ -11,6 +11,13 @@ export function TableHeader() {
export default async function guestsTable() { 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") let guests: Guest[] = await fetch("http://localhost:3001/guests.json")
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
@ -81,7 +88,7 @@ export default async function guestsTable() {
</span> </span>
</td> </td>
<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 Invite
</button>)} </button>)}
</td> </td>