aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/leaderboard.svelte
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-08-21 21:18:06 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-08-21 21:18:06 +0200
commit8eec57f5606c1d1757383f4c0ca40d2cc3334572 (patch)
tree49d69c8864f59db52061f1222a43e00266e6ab04 /web/pw-server/src/routes/leaderboard.svelte
parent64d24c9e3d7e744788644b00cdb2ec44a999d9cd (diff)
downloadplanetwars.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.svelte28
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} />