next-enterprise/pages/index.tsx

34 lines
942 B
TypeScript
Raw Normal View History

2023-07-12 15:47:01 +02:00
export async function getServerSideProps({ res }) {
res.setHeader("Cache-Control", "public, s-maxage=10, stale-while-revalidate=59")
const response = await fetch("http://localhost:3000/api/players", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
const allPlayers = await response.json()
2023-04-21 11:27:42 +02:00
2023-07-12 15:47:01 +02:00
return {
props: { allPlayers },
}
}
export default function Web({ allPlayers }) {
2023-03-25 16:53:07 +01:00
return (
2023-04-16 18:17:54 +02:00
<>
2023-07-12 15:47:01 +02:00
<section>
2023-04-16 18:17:54 +02:00
<div className="mx-auto grid max-w-screen-xl px-4 py-8 text-center lg:py-16">
<div className="mx-auto place-self-center">
2023-07-12 15:47:01 +02:00
<h1 className="mb-4 max-w-2xl text-4xl font-extrabold leading-none tracking-tight md:text-5xl xl:text-6xl">
IsaCon
2023-04-16 18:17:54 +02:00
</h1>
2023-07-12 15:47:01 +02:00
{allPlayers.data.map((player) => (
<div key={player.id}>{player.name}</div>
2023-04-21 17:50:04 +02:00
))}
2023-04-16 18:17:54 +02:00
</div>
</div>
</section>
</>
)
2023-03-25 16:53:07 +01:00
}