51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
/** @type {import('./$types').LayoutLoad} */
|
|
console.log(`ae_journals +layout.ts start`);
|
|
|
|
// Imports
|
|
// import { browser } from '$app/environment';
|
|
// import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
|
|
|
export async function load({ params, parent }) {
|
|
const log_lvl: number = 0;
|
|
|
|
const parent_data = await parent();
|
|
// console.log(`ae_journals +layout.ts parent_data:`, parent_data);
|
|
|
|
const account_id = parent_data.account_id;
|
|
if (!account_id) {
|
|
console.log(`journals +layout.ts: The account_id was not found in the parent_data!!!`);
|
|
return false;
|
|
}
|
|
|
|
let ae_acct = parent_data[account_id];
|
|
|
|
if (!ae_acct) {
|
|
console.warn(`ae Journals +layout.ts: Account ${account_id} not found in parent data. Initializing ghost acct.`);
|
|
ae_acct = {
|
|
api: parent_data.ae_api || {},
|
|
slct: {
|
|
account_id: account_id
|
|
}
|
|
};
|
|
}
|
|
|
|
if (log_lvl) {
|
|
console.log(`ae_acct = `, ae_acct);
|
|
}
|
|
|
|
// let submenu = {
|
|
// main: {name: 'Main', href: '/journals', access: false},
|
|
// // manage: {name: 'Manage', href: '/journals/manage', access: 'administrator', disable: true, hide: true},
|
|
// locations: {name: 'Locations', href: `/journals/${note_id}/locations`, access: false, disable: false, hide: false},
|
|
// };
|
|
// parent_data.submenu = submenu
|
|
|
|
// WARNING: Precaution against shared parent_data between sites and sessions.
|
|
parent_data[account_id] = ae_acct;
|
|
|
|
return parent_data;
|
|
}
|
|
|
|
// export const prerender = false;
|
|
// export const prerender = true;
|