Files
OSIT-AE-App-Svelte/src/routes/events_speakers/+layout.svelte
2024-03-27 20:15:30 -04:00

45 lines
1.3 KiB
Svelte

<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
import { onMount } from 'svelte';
import { localStorageStore } from '@skeletonlabs/skeleton';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
// $slct.account_id = data.account_id;
// console.log(`$slct.account_id = `, $slct.account_id);
let ae_acct = data[$slct.account_id];
// console.log(`ae_acct = `, ae_acct);
// $ae_loc = data.ae_loc;
$ae_loc.mod.events.event_id = data.ae_slct.event_id;
// $events_slct.event_id = ae_acct.slct.event_id
// $events_slct.event_obj = ae_acct.slct.event_obj
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
if (data.ae_ds) {
for (let [key, value] of Object.entries(data.ae_ds)) {
console.log(`ae_ds__ key: ${key}, value:`, value);
localStorageStore(`ae_ds__${key}`, value);
}
}
onMount(() => {
// console.log(`$slct.event_id = `, $slct.event_id);
if (data.url.searchParams.get('event_id')) {
$slct.event_id = data.url.searchParams.get('event_id');
$ae_loc.mod.events.event_id = data.url.searchParams.get('event_id');
}
});
</script>
<svelte:head>
<title>Speaker Hub - {$ae_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<slot></slot>