Feature: Mark guests as invited #60
@ -1,23 +1,31 @@
|
||||
import { Guest } from '@/app/lib/definitions';
|
||||
'use client';
|
||||
|
||||
import clsx from 'clsx';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Guest } from '@/app/lib/definitions';
|
||||
|
||||
export default async function guestsTable() {
|
||||
|
||||
let guests: Guest[] = await fetch("http://localhost:3001/guests.json")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
return data.data.map((record: any) => {
|
||||
return ({
|
||||
id: record.id,
|
||||
name: record.attributes.name,
|
||||
email: record.attributes.email,
|
||||
group_name: record.attributes.group_name,
|
||||
status: record.attributes.status
|
||||
});
|
||||
export default function guestsTable() {
|
||||
function loadGuests() {
|
||||
fetch("http://localhost:3001/guests.json")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
setGuests(data.data.map((record: any) => {
|
||||
return ({
|
||||
id: record.id,
|
||||
name: record.attributes.name,
|
||||
email: record.attributes.email,
|
||||
group_name: record.attributes.group_name,
|
||||
status: record.attributes.status
|
||||
});
|
||||
}));
|
||||
}, (error) => {
|
||||
return [];
|
||||
});
|
||||
}, (error) => {
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
||||
const [guests, setGuests] = useState<Array<Guest>>([]);
|
||||
|
||||
guests.length === 0 && loadGuests();
|
||||
|
||||
return (
|
||||
<div className="w-full relative overflow-x-auto shadow-md sm:rounded-lg">
|
||||
|
Loading…
x
Reference in New Issue
Block a user