Trying to make things work better...
This commit is contained in:
@@ -1,23 +1,41 @@
|
||||
/** @type {import('./$types').LayoutLoad} */
|
||||
console.log(`ae_sponsorships +layout.ts start`);
|
||||
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
import { api } from '$lib/api';
|
||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { spons_func } from '$lib/ae_sponsorships_functions';
|
||||
|
||||
|
||||
export async function load({ params, parent, url }) { // route
|
||||
// console.log(`Svelte Sponsorships +layout.ts data.params:`, params);
|
||||
// console.log(`Svelte Sponsorships +layout.ts data.route:`, route);
|
||||
// console.log(`Svelte Sponsorships +layout.ts data.url:`, url);
|
||||
|
||||
// const { ae_init, root_layout_ts } = await parent();
|
||||
let data = await parent();
|
||||
// console.log(`ae_events_badges +layout.ts data:`, data);
|
||||
|
||||
data.ae_sponsorships_layout_ts = true;
|
||||
|
||||
if (data.ae_loc.account_id) {
|
||||
} else {
|
||||
console.log(`The account_id was not found in the data.ae_loc!!!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let sponsorship_cfg_id = null;
|
||||
if (data.ae_loc.site_cfg_json.slct__sponsorship_cfg_id) {
|
||||
sponsorship_cfg_id = data.ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
|
||||
// } else if (data.ae_loc.default__sponsorship_cfg_id) {
|
||||
// sponsorship_cfg_id = data.ae_loc.default__sponsorship_cfg_id;
|
||||
} else {
|
||||
console.log(`The sponsorship_cfg_id was not found in the data.ae_loc.site_cfg_json!!!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let load_sponsorship_cfg_obj = spons_func.handle_load_ae_obj_id__sponsorship_cfg({api_cfg: data.ae_api, sponsorship_cfg_id: sponsorship_cfg_id, try_cache: false});
|
||||
|
||||
data.ae_slct.sponsorship_cfg_id = sponsorship_cfg_id;
|
||||
data.ae_slct.sponsorship_cfg_obj = await load_sponsorship_cfg_obj;
|
||||
|
||||
|
||||
|
||||
let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
|
||||
@@ -45,7 +63,7 @@ export async function load({ params, parent, url }) { // route
|
||||
ds_type = 'text';
|
||||
|
||||
ds_code_li[ds_code] = await api.get_data_store_obj_w_code({
|
||||
api_cfg: get(ae_api),
|
||||
api_cfg: data.ae_api,
|
||||
data_store_code: ds_code,
|
||||
data_type: ds_type,
|
||||
log_lvl: 2
|
||||
@@ -88,7 +106,7 @@ export async function load({ params, parent, url }) { // route
|
||||
ds_type = 'text';
|
||||
|
||||
ds_code_li[ds_code] = await api.get_data_store_obj_w_code({
|
||||
api_cfg: get(ae_api),
|
||||
api_cfg: data.ae_api,
|
||||
data_store_code: ds_code,
|
||||
data_type: ds_type,
|
||||
log_lvl: 2
|
||||
@@ -128,23 +146,31 @@ export async function load({ params, parent, url }) { // route
|
||||
});
|
||||
console.log(`ae_ ds_code_li = `, ds_code_li);
|
||||
|
||||
let ae_loc_tmp = get(ae_loc);
|
||||
console.log(`ae_loc = `, ae_loc_tmp);
|
||||
// let ae_loc_tmp = get(ae_loc);
|
||||
// console.log(`ae_loc = `, ae_loc_tmp);
|
||||
|
||||
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,
|
||||
}
|
||||
// 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);
|
||||
ae_loc.set(ae_loc_tmp);
|
||||
// // ae_loc_tmp = {
|
||||
// // ...ae_loc_tmp,
|
||||
// // 'ds': ae_ds_tmp,
|
||||
// // }
|
||||
// // console.log(`ae_loc = `, ae_loc_tmp);
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
|
||||
// // console.log(`ae_loc_tmp = `, ae_loc_tmp);
|
||||
// data['ae_loc'] = ae_loc_tmp;
|
||||
|
||||
data['ae_ds'] = ds_code_li;
|
||||
|
||||
// return data_struct;
|
||||
return data;
|
||||
}
|
||||
|
||||
// export const prerender = false;
|
||||
export const prerender = true;
|
||||
Reference in New Issue
Block a user