aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/matches/index.svelte
blob: af0cd0841770d403f486913da60bec1b7c7b7713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script lang="ts" context="module">
  import { ApiClient } from "$lib/api_client";

  export async function load({ fetch }) {
    try {
      const apiClient = new ApiClient(fetch);
      const matches = await apiClient.get("/api/matches");

      return {
        props: {
          matches,
        },
      };
    } catch (error) {
      return {
        status: error.status,
        error: new Error("failed to load matches"),
      };
    }
  }
</script>

<script lang="ts">
  import MatchList from "$lib/components/matches/MatchList.svelte";

  export let matches: object[];
</script>

<div class="container">
  <MatchList {matches} />
</div>

<style lang="scss">
  .container {
    width: 800px;
    margin: 0 auto;
  }
</style>