<script>
  import { OpenAPI, TrackService } from "@odit/lfk-client-js";
  OpenAPI.BASE = "http://localhost:4010";
  let tracks_promise = TrackService.trackControllerGetAll();
</script>

<h1>Tracks</h1>
{#await tracks_promise then tracks}
  <h4>{tracks.length}</h4>
  <hr />
  {#if tracks.length % 2 == 0}
    <ul>
      {#each tracks as item}
        <li>{item.distance}</li>
      {/each}
    </ul>
  {:else}
    {#each tracks as item}<span>{item.distance}</span><br />{/each}
  {/if}
{:catch error}
  ERORRRRR
{/await}
