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

43 lines
1.0 KiB
Svelte

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