Further componentisation and advancements to homepage
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
<script>
|
||||
import Header from '$lib/header.svelte'
|
||||
import Header from '$lib/navigation/header.svelte'
|
||||
import Nav from '$lib/navigation/nav.svelte'
|
||||
|
||||
import {onMount} from 'svelte'
|
||||
|
||||
const title = "Public Board"
|
||||
const page = "ldb"
|
||||
|
||||
async function getHeadcode() {
|
||||
return new URLSearchParams(window.location.search).get('station');
|
||||
@@ -20,7 +19,7 @@
|
||||
const station = await getHeadcode();
|
||||
document.getElementById('station').textContent = station;
|
||||
const data = await fetch(`https://owlboard.info/api/v1/ldb/${station}`);
|
||||
const jsonData = await data.json();
|
||||
const jsonData = await data.json()['GetStationBoardResult'];
|
||||
//document.getElementById('data_raw').textContent = JSON.stringify(await data.json());
|
||||
})
|
||||
|
||||
@@ -29,9 +28,9 @@
|
||||
<Header {title} />
|
||||
|
||||
<p>Station: <span id="station"></span></p>
|
||||
{#each jsonData as item}
|
||||
<p>{item.GetStationBoardResult.trainServices.service.operator}</p>
|
||||
{#each jsonData.trainServices.service as item}
|
||||
<p>{item.operator}</p>
|
||||
{/each}
|
||||
|
||||
|
||||
<Nav {page} />
|
||||
<Nav />
|
||||
Reference in New Issue
Block a user