Add store for UUID and conditional loading of the LDB page for public/staff boards
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<script>
|
||||
import Header from '$lib/navigation/header.svelte'
|
||||
import Nav from '$lib/navigation/nav.svelte'
|
||||
import PublicLdb from '$lib/ldb/public-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'
|
||||
|
||||
const title = "Public Board"
|
||||
@@ -11,10 +13,17 @@
|
||||
|
||||
let station;
|
||||
let staff;
|
||||
let uuidValue;
|
||||
|
||||
$: uuidValue = $uuid;
|
||||
|
||||
onMount(async () => {
|
||||
station = await getHeadcode() || "";
|
||||
staff = false;
|
||||
if (uuidValue !== null) {
|
||||
staff = true;
|
||||
} else {
|
||||
staff = false;
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -24,6 +33,8 @@
|
||||
<!-- If 'uuid' exists in store then load StaffLdb else load PublicLdb -->
|
||||
{#if !staff}
|
||||
<PublicLdb {station} />
|
||||
{:else}
|
||||
<StaffLdb {station} />
|
||||
{/if}
|
||||
|
||||
<Nav />
|
||||
|
||||
Reference in New Issue
Block a user