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

41 lines
917 B
Svelte
Raw Normal View History

2023-06-13 13:38:59 +01:00
<script>
2023-06-16 22:55:18 +01:00
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';
2023-06-16 22:55:18 +01:00
import {onMount} from 'svelte'
2023-06-13 13:38:59 +01:00
2023-06-16 22:55:18 +01:00
const title = "Public Board"
async function getHeadcode() {
2023-06-13 13:38:59 +01:00
return new URLSearchParams(window.location.search).get('station');
}
2023-06-17 01:53:08 +01:00
let station;
let staff;
let uuidValue;
$: uuidValue = $uuid;
2023-06-14 00:43:06 +01:00
2023-06-13 13:38:59 +01:00
onMount(async () => {
2023-06-16 22:55:18 +01:00
station = await getHeadcode() || "";
if (uuidValue !== null) {
staff = true;
} else {
staff = false;
}
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
2023-06-16 22:55:18 +01:00
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
2023-06-17 01:53:08 +01:00
{#if !staff}
2023-06-16 22:55:18 +01:00
<PublicLdb {station} />
{:else}
<StaffLdb {station} />
2023-06-17 01:53:08 +01:00
{/if}
2023-06-13 13:38:59 +01:00
2023-06-16 22:55:18 +01:00
<Nav />