diff --git a/dockerfile b/dockerfile index bba8dd3..a3ddff1 100644 --- a/dockerfile +++ b/dockerfile @@ -1,4 +1,4 @@ -from node:latest AS build +FROM node:latest AS build WORKDIR /app COPY package.json / diff --git a/src/routes/ldb/+page.svelte b/src/routes/ldb/+page.svelte index e95b63e..a7ec43f 100644 --- a/src/routes/ldb/+page.svelte +++ b/src/routes/ldb/+page.svelte @@ -11,11 +11,17 @@ return new URLSearchParams(window.location.search).get('station'); } + /** + * @type {any[]} + */ + let jsonData = [] // Extract train data from the object to pass to #each + onMount(async () => { const station = await getHeadcode(); document.getElementById('station').textContent = station; - const data = await fetch(`https://owlboard.info/api/v1/ldb/${station}`) - document.getElementById('data_raw').textContent = JSON.stringify(await data.json()); + const data = await fetch(`https://owlboard.info/api/v1/ldb/${station}`); + const jsonData = await data.json(); + //document.getElementById('data_raw').textContent = JSON.stringify(await data.json()); }) @@ -23,7 +29,9 @@

Station:

-

+{#each jsonData as item} +

{item.GetStationBoardResult.trainServices.operator}

+{/each}