Files
OSIT-AE-App-Svelte/src/routes/events_badges/+layout.ts

51 lines
1.8 KiB
TypeScript

/** @type {import('./$types').LayoutLoad} */
console.log(`ae_events_badges +layout.ts start`);
import { events_func } from '$lib/ae_events_functions';
export async function load({ parent }) {
let data = await parent();
// console.log(`ae_events_badges +layout.ts data:`, data);
let account_id = data.account_id;
let ae_acct = data[account_id];
console.log(`ae_acct = `, ae_acct);
if (!account_id) {
console.log(`events_badges +layout.ts: The account_id was not found in the data!!!`);
return false;
}
let event_id = ae_acct.slct.event_id;
if (!event_id) {
console.log(`events_badges +layout.ts: The event_id was not found in the data!!!`);
return false;
}
let load_event_obj = events_func.handle_load_ae_obj_id__event({api_cfg: ae_acct.api, event_id: event_id, try_cache: true});
ae_acct.slct.event_obj = load_event_obj;
let submenu = {
main: {name: 'Main', href: '/events_badges', access: false},
// manage: {name: 'Manage', href: '/events_badges/manage', access: 'administrator', disable: true, hide: true},
review: {name: 'Review', href: '/events_badges/review', access: false, disable: false, hide: false},
// print: {name: 'Print', href: '/events_badges/print', access: 'trusted', disable: true, hide: false},
// view: {name: 'View', href: '/events_badges/view', access: 'trusted', hide: true}, // event_badge_id
// new: {name: 'New', href: '/events_badges/new'},
// sponsorships: {name: 'Sponsorships', href: '/sponsorships', disable: true, hide: true},
};
data.submenu = submenu
// WARNING: Precaution against shared data between sites and sessions.
data[account_id] = ae_acct;
return data;
}
// export const prerender = false;
// export const prerender = true;