From 8eec57f5606c1d1757383f4c0ca40d2cc3334572 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Sun, 21 Aug 2022 21:18:06 +0200
Subject: extract leaderboard from editor

---
 web/pw-server/src/routes/leaderboard.svelte | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 web/pw-server/src/routes/leaderboard.svelte

(limited to 'web/pw-server/src/routes/leaderboard.svelte')

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} />
-- 
cgit v1.2.3

