Compare commits
2 Commits
45e2665997
...
5918ce050c
Author | SHA1 | Date | |
---|---|---|---|
5918ce050c | |||
a4edcbca07 |
@ -6,11 +6,18 @@ import { Suspense } from 'react';
|
|||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
||||||
export function TableHeader() {
|
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) => {
|
||||||
@ -50,6 +57,7 @@ export default async function guestsTable() {
|
|||||||
<th scope="col" className="px-6 py-3">
|
<th scope="col" className="px-6 py-3">
|
||||||
Status
|
Status
|
||||||
</th>
|
</th>
|
||||||
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -79,6 +87,11 @@ export default async function guestsTable() {
|
|||||||
{guest.status}
|
{guest.status}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{guest.status === 'Considered' && (<button onClick={handleInviteGuest} className="bg-blue-300 hover:bg-blue-500 text-white py-1 px-2 rounded">
|
||||||
|
Invite
|
||||||
|
</button>)}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user