Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | <svelte:options customElement="st-routes-factions" /> <script lang="ts"> import { onMount } from "svelte"; import Loader from "$ui/loader/src/loader.svelte"; import type { Faction } from "$models/faction"; let isLoading = true; let factions: Faction[] = []; onMount(async () => { const options = { headers: { "Content-Type": "application/json", Authorization: `Bearer ${import.meta.env.VITE_API_TOKEN}`, }, }; fetch(`${import.meta.env.VITE_API_URL}/factions`, options) .then((response) => response.json()) .then((response) => { factions = response.data.map((faction: Faction) => { return { symbol: faction.symbol, name: faction.name, description: faction.description, headquarters: faction.headquarters, traits: faction.traits, isRecruiting: faction.isRecruiting, }; }); isLoading = false; }); }); </script> {#if isLoading} <Loader /> {:else} <table> <thead> <tr> <th>Symbol</th> <th>Name</th> <th>Description</th> <th>Headquarters</th> <th>Traits</th> <th>Recruiting</th> </tr> </thead> <tbody> {#each factions as faction} <tr> <td>{faction.symbol}</td> <td>{faction.name}</td> <td>{faction.description}</td> <td>{faction.headquarters} </td> <td> <ul> {#each faction.traits as trait} <li>{trait.name}</li> {/each} </ul> </td> <td>{faction.isRecruiting}</td> </tr> {/each} </tbody> </table> {/if} |