diff options
Diffstat (limited to 'web/pw-server/src/routes/leaderboard.svelte')
-rw-r--r-- | web/pw-server/src/routes/leaderboard.svelte | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/web/pw-server/src/routes/leaderboard.svelte b/web/pw-server/src/routes/leaderboard.svelte new file mode 100644 index 0000000..7c4da6e --- /dev/null +++ b/web/pw-server/src/routes/leaderboard.svelte @@ -0,0 +1,28 @@ +<script lang="ts" context="module"> + import { ApiClient } from "$lib/api_client"; + + export async function load({ fetch }) { + try { + const apiClient = new ApiClient(fetch); + const leaderboard = await apiClient.get("/api/leaderboard"); + return { + props: { + leaderboard, + }, + }; + } catch (error) { + return { + status: error.status, + error: error, + }; + } + } +</script> + +<script lang="ts"> + import Leaderboard from "$lib/components/Leaderboard.svelte"; + + export let leaderboard: object[]; +</script> + +<Leaderboard {leaderboard} /> |