diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-08-21 21:18:06 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-08-21 21:18:06 +0200 |
commit | 8eec57f5606c1d1757383f4c0ca40d2cc3334572 (patch) | |
tree | 49d69c8864f59db52061f1222a43e00266e6ab04 /web/pw-server/src/routes/leaderboard.svelte | |
parent | 64d24c9e3d7e744788644b00cdb2ec44a999d9cd (diff) | |
download | planetwars.dev-8eec57f5606c1d1757383f4c0ca40d2cc3334572.tar.xz planetwars.dev-8eec57f5606c1d1757383f4c0ca40d2cc3334572.zip |
extract leaderboard from editor
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} /> |