<script>
    import Header from '$lib/navigation/header.svelte'
    import Nav from '$lib/navigation/nav.svelte'
    import PublicLdb from '$lib/ldb/public-ldb.svelte';   
    import {onMount} from 'svelte'

    const title = "Public Board"
    async function getHeadcode() {
        return new URLSearchParams(window.location.search).get('station');
    }

    let station;
    let staff;

    onMount(async () => {
        station = await getHeadcode() || "";
        staff = false;
    })

</script>

<Header {title} />

<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
{#if !staff}
<PublicLdb {station} />
{/if}

<Nav />
