100 lines
2.9 KiB
TypeScript
100 lines
2.9 KiB
TypeScript
/** @type {import('./$types').LayoutLoad} */
|
|
console.log(`ae_events_speakers +layout.ts start`);
|
|
|
|
// import { browser } from '$app/environment';
|
|
|
|
// import type { key_val } from '$lib/ae_stores';
|
|
// import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
|
// import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
|
|
import { events_func } from '$lib/ae_events_functions';
|
|
|
|
|
|
export async function load({ parent }) {
|
|
|
|
let data = await parent();
|
|
|
|
let account_id = data.account_id;
|
|
let ae_acct = data[account_id];
|
|
// console.log(`ae_acct = `, ae_acct);
|
|
|
|
// if (!account_id) {
|
|
// console.log(`events_speakers +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_speakers +layout.ts: The event_id was not found in the data!!!`);
|
|
return false;
|
|
}
|
|
|
|
let load_event_obj = events_func.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;
|
|
|
|
data.ae_events_speakers_layout_ts = true;
|
|
|
|
let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
|
|
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
|
let ds_code: string = '';
|
|
let ds_type: null|string = null;
|
|
|
|
ds_code = 'hub__page__events_speakers__create_info_header';
|
|
ds_type = 'text';
|
|
|
|
// ds_code_li[ds_code]
|
|
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
|
|
.then(function (ds_results) {
|
|
if (ds_results) {
|
|
// console.log(`ae_ ds_results = `, ds_results);
|
|
return ds_results;
|
|
}
|
|
}
|
|
);
|
|
|
|
ds_code = 'hub__page__events_speakers__create_info';
|
|
ds_type = 'text';
|
|
|
|
// ds_code_li[ds_code]
|
|
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
|
|
.then(function (ds_results) {
|
|
if (ds_results) {
|
|
// console.log(`ae_ ds_results = `, ds_results);
|
|
return ds_results;
|
|
}
|
|
}
|
|
);
|
|
|
|
// let ae_ds_tmp = ae_loc_tmp.ds;
|
|
// // Merge the new data into the existing data
|
|
// // ae_ds_tmp = {
|
|
// // ...ae_ds_tmp,
|
|
// // ...ds_code_li,
|
|
// // }
|
|
|
|
// // ae_loc_tmp = {
|
|
// // ...ae_loc_tmp,
|
|
// // 'ds': ae_ds_tmp,
|
|
// // }
|
|
|
|
// // console.log(`ae_loc = `, ae_loc_tmp);
|
|
// data['ae_loc'] = ae_loc_tmp;
|
|
|
|
data['ae_ds'] = {
|
|
...data['ae_ds'],
|
|
...ae_acct['ds']
|
|
}
|
|
|
|
// WARNING: Precaution against shared data between sites and sessions.
|
|
data[account_id] = ae_acct;
|
|
|
|
return data;
|
|
}
|
|
|
|
// export const prerender = true;
|