Add some sort of rendering

This commit is contained in:
2024-10-28 19:54:55 +01:00
parent 5b19b72ebf
commit 460503ba4a
2 changed files with 26 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
---
import type { APIResponse, Player } from "../types";
const res = await fetch("http://localhost:3000/player");
const data: APIResponse<Player[]> = await res.json();
console.log(data);
---
<div>
{
data.success &&
data.data.map((player) => (
<div>
<a href={`/player/${player.name}`}>{player.name}</a>
</div>
))
}
{!data.success && <div>{data.message}</div>}
</div>

View File

@@ -0,0 +1,7 @@
---
const { name } = Astro.params;
---
<div>
<h1>Hello {name}!</h1>
</div>