import Layout from "@/components/Layout";
export interface TournamentType {
_id: string;
location: string;
department: string;
tournament: string;
url: string;
time_control: string;
date: string;
coordinates: [number, number];
}
async function getTournaments() {
const res = await fetch("http://localhost:3000/api/tournaments", {
next: { revalidate: 300 },
});
return await res.json();
}
export default async function Tournaments() {
const data = await getTournaments();
console.log(data);
const tournaments = data.map((t: TournamentType) => (
| {t.date} |
{t.location} |
{t.tournament} |
{t.time_control} |
));
return (
| Date |
Ville |
Tournois |
Cadence |
{tournaments}
);
}