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 | <svelte:options customElement="st-routes" /> <script lang="ts"> import { onMount } from "svelte"; import Summary from "$components/summary.svelte"; import type { Agent } from "$models/agent"; import Loader from "$ui/loader/src/loader.svelte"; let isLoading = true; let agent: Agent; onMount(async () => { const options = { headers: { "Content-Type": "application/json", Authorization: `Bearer ${import.meta.env.VITE_API_TOKEN}`, }, }; // retrieve agent data fetch(`${import.meta.env.VITE_API_URL}/my/agent`, options) .then((response) => response.json()) .then((response) => { agent = { accountId: response.data.accountId, symbol: response.data.symbol, headquarters: response.data.headquarters, credits: response.data.credits, startingFaction: { symbol: response.data.startingFaction, }, }; isLoading = false; }) .catch((error) => { // eslint-disable-next-line no-console console.error(error); isLoading = false; }); }); </script> <svelte:head> <title>Space Traders</title> <html lang="en-GB"></html> </svelte:head> {#if isLoading} <Loader /> {:else} <Summary {agent} /> {/if} |