Progress on more low level updates to the Events module loading process.
This commit is contained in:
@@ -1,22 +1,65 @@
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { browser } from '$app/environment';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
export async function load({ parent }) {
|
||||
let log_lvl: number = 0;
|
||||
|
||||
let data = await parent();
|
||||
let parent_data = await parent();
|
||||
|
||||
// let account_id = data.account_id;
|
||||
// if (!account_id) {
|
||||
// console.log(`events_pres_mgmt +page.ts: The account_id was not found in the data!!!`);
|
||||
// error(500, {
|
||||
// message: 'Not found'
|
||||
// });
|
||||
// }
|
||||
let account_id = parent_data.account_id;
|
||||
|
||||
// let ae_acct = data[account_id];
|
||||
let ae_acct = parent_data[account_id];
|
||||
|
||||
let event_id = ae_acct.slct.event_id; // From root +layout.ts
|
||||
if (!event_id) {
|
||||
if (log_lvl) {
|
||||
console.log(`INFO: events +layout.ts: The event_id was not found in the parent_data.`);
|
||||
}
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
if (event_id) {
|
||||
// let ae_params = {};
|
||||
|
||||
let load_event_obj_li = await events_func.load_ae_obj_id__event({
|
||||
api_cfg: ae_acct.api,
|
||||
event_id: event_id,
|
||||
hidden: 'all', // 'not_hidden' to load only visible entries
|
||||
// params: ae_params,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
ae_acct.slct.event_obj_li = load_event_obj_li;
|
||||
}
|
||||
|
||||
let load_event_obj_li = await events_func.load_ae_obj_li__event({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
inc_session_li: true,
|
||||
hidden: 'all', // 'not_hidden'
|
||||
enabled: 'enabled',
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
limit: 25,
|
||||
// params: ae_params,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
ae_acct.slct.event_obj_li = load_event_obj_li;
|
||||
|
||||
|
||||
}
|
||||
|
||||
parent_data[account_id] = ae_acct;
|
||||
|
||||
return parent_data;
|
||||
|
||||
|
||||
// let ae_acct = parent_data[account_id];
|
||||
|
||||
// Should we limit these to event.conference = true?
|
||||
// let load_event_obj_li = await events_func.load_ae_obj_li__event({
|
||||
@@ -28,7 +71,7 @@ export async function load({ parent }) {
|
||||
// });
|
||||
// ae_acct.slct.event_obj_li = load_event_obj_li;
|
||||
|
||||
// data[account_id] = ae_acct;
|
||||
// parent_data[account_id] = ae_acct;
|
||||
|
||||
return data;
|
||||
// return parent_data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user