owlboard-svelte/src/routes/ldb/+page.svelte

41 lines
917 B
Svelte

<script>
import Header from '$lib/navigation/header.svelte'
import Nav from '$lib/navigation/nav.svelte'
import PublicLdb from '$lib/ldb/public-ldb.svelte';
import StaffLdb from '$lib/ldb/staff-ldb.svelte';
import { uuid } from '$lib/stores/uuid.js';
import {onMount} from 'svelte'
const title = "Public Board"
async function getHeadcode() {
return new URLSearchParams(window.location.search).get('station');
}
let station;
let staff;
let uuidValue;
$: uuidValue = $uuid;
onMount(async () => {
station = await getHeadcode() || "";
if (uuidValue !== null) {
staff = true;
} else {
staff = false;
}
})
</script>
<Header {title} />
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
{#if !staff}
<PublicLdb {station} />
{:else}
<StaffLdb {station} />
{/if}
<Nav />