2023-06-13 13:38:59 +01:00
|
|
|
<script>
|
2023-06-15 21:32:14 +01:00
|
|
|
import Header from '$lib/navigation/header.svelte'
|
2023-06-15 18:19:23 +01:00
|
|
|
import Nav from '$lib/navigation/nav.svelte'
|
2023-06-13 13:38:59 +01:00
|
|
|
|
|
|
|
import {onMount} from 'svelte'
|
|
|
|
|
|
|
|
const title = "Public Board"
|
|
|
|
|
|
|
|
async function getHeadcode() {
|
|
|
|
return new URLSearchParams(window.location.search).get('station');
|
|
|
|
}
|
|
|
|
|
2023-06-14 00:43:06 +01:00
|
|
|
let jsonData = [] // Extract train data from the object to pass to #each
|
|
|
|
|
2023-06-13 13:38:59 +01:00
|
|
|
onMount(async () => {
|
2023-06-13 13:58:04 +01:00
|
|
|
const station = await getHeadcode();
|
|
|
|
document.getElementById('station').textContent = station;
|
2023-06-14 00:43:06 +01:00
|
|
|
const data = await fetch(`https://owlboard.info/api/v1/ldb/${station}`);
|
2023-06-15 21:42:26 +01:00
|
|
|
jsonData = await data.json();
|
2023-06-13 13:38:59 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2023-06-14 11:02:46 +01:00
|
|
|
<Header {title} />
|
2023-06-13 13:38:59 +01:00
|
|
|
|
|
|
|
<p>Station: <span id="station"></span></p>
|
2023-06-15 21:42:26 +01:00
|
|
|
|
|
|
|
<p>{JSON.stringify(jsonData)}</p>
|
2023-06-13 13:58:04 +01:00
|
|
|
|
2023-06-13 13:38:59 +01:00
|
|
|
|
2023-06-15 21:32:14 +01:00
|
|
|
<Nav />
|