General work through out the day. Lots of interruptions from the dogs.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
import { api } from '$lib/api';
|
||||
// import { api } from '$lib/api';
|
||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
@@ -27,7 +27,6 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
||||
let ds_code: null|string = null;
|
||||
|
||||
|
||||
let data_struct = {
|
||||
ae_loc: ae_loc_tmp,
|
||||
ae_api: ae_api_tmp,
|
||||
@@ -36,21 +35,25 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
ae_m_sponsorships: {},
|
||||
ae_m_events: {},
|
||||
ae_m_events_speakers: {},
|
||||
ae_slct: {},
|
||||
|
||||
iframe: false,
|
||||
|
||||
ae_root_layout_ts: true,
|
||||
|
||||
params: params,
|
||||
|
||||
url: url,
|
||||
|
||||
// Not really used yet
|
||||
sections: [
|
||||
{ slug: 'new', title: 'New Test' },
|
||||
{ slug: 'manage', title: 'Manage Test' },
|
||||
{ slug: 'test', title: 'Test Test' },
|
||||
],
|
||||
|
||||
params: params,
|
||||
|
||||
url: url,
|
||||
|
||||
// Not really used yet
|
||||
submenu: {},
|
||||
};
|
||||
|
||||
let loading_results = null;
|
||||
@@ -82,7 +85,7 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
ae_api_tmp['headers']['x-account-id'] = site_domain_results.account_id_random;
|
||||
ae_api_tmp['headers']['x-no-account-id'] = null;
|
||||
|
||||
ae_api.set(ae_api_tmp);
|
||||
// ae_api.set(ae_api_tmp);
|
||||
// console.log(`ae_api = `, get(ae_api));
|
||||
|
||||
ae_loc_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
@@ -92,13 +95,6 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
ae_loc_tmp['site_style_href'] = site_domain_results.style_href;
|
||||
ae_loc_tmp['site_google_tracking_id'] = site_domain_results.google_tracking_id;
|
||||
ae_loc_tmp['site_cfg_json'] = site_domain_results.cfg_json;
|
||||
|
||||
// Get updated the data just in case.
|
||||
// ae_loc_tmp = get(ae_loc);
|
||||
// ae_loc_tmp.account_id = site_domain_results.account_id_random;
|
||||
// ae_loc_tmp.core = ae_core;
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -131,112 +127,15 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
return true;
|
||||
})
|
||||
|
||||
// .then(async function (results) {
|
||||
// // We are intentionally loading these in series, not parallel to limit the number of simultaneous requests.
|
||||
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// // Loading the header and footer in series, not parallel.
|
||||
// ds_code = 'hub__site__appshell_header';
|
||||
// await handle_get_data_store_obj_w_code({code: ds_code})
|
||||
// .then(function (ds_hub_site_header_results) {
|
||||
|
||||
// if (ds_hub_site_header_results) {
|
||||
// // console.log(`ae_ ds_hub_site_header_results = `, ds_hub_site_header_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_hub_site_header_results;
|
||||
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// }
|
||||
|
||||
// })
|
||||
|
||||
// .then(async function () {
|
||||
|
||||
// ds_code = 'hub__site__appshell_footer';
|
||||
// await handle_get_data_store_obj_w_code({code: ds_code})
|
||||
// .then(function (ds_hub_site_footer_results) {
|
||||
// if (ds_hub_site_footer_results) {
|
||||
// // console.log(`ae_ hub__site__appshell_footer = `, ds_hub_site_footer_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_hub_site_footer_results;
|
||||
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// }
|
||||
// });
|
||||
|
||||
// })
|
||||
|
||||
// .then(async function () {
|
||||
|
||||
// ds_code = 'hub__site__root_page_content';
|
||||
// await handle_get_data_store_obj_w_code({code: ds_code})
|
||||
// .then(function (ds_code_results) {
|
||||
// if (ds_code_results) {
|
||||
// // console.log(`ae_ hub__site__root_page_content = `, ds_code_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_code_results;
|
||||
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// }
|
||||
// });
|
||||
|
||||
// })
|
||||
|
||||
// .then(async function () {
|
||||
|
||||
// // Loading the header and footer in series, not parallel.
|
||||
// ds_code = 'hub__page__appshell_header_lead';
|
||||
// await handle_get_data_store_obj_w_code({code: ds_code})
|
||||
// .then(function (ds_code_results) {
|
||||
// if (ds_code_results) {
|
||||
// // console.log(`ae_ hub__page__appshell_header_lead = `, ds_code_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_code_results;
|
||||
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// }
|
||||
// });
|
||||
|
||||
// })
|
||||
|
||||
// .then(async function () {
|
||||
|
||||
// ds_code = 'hub__page__appshell_header_trail';
|
||||
// await handle_get_data_store_obj_w_code({code: ds_code})
|
||||
// .then(function (ds_code_results) {
|
||||
// if (ds_code_results) {
|
||||
// // console.log(`hub__page__appshell_header_trail = `, ds_code_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
|
||||
// ds_code_li[ds_code] = ds_code_results;
|
||||
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// }
|
||||
// });
|
||||
|
||||
// });
|
||||
|
||||
// })
|
||||
.finally(function () {
|
||||
|
||||
let iframe = url.searchParams.get('iframe');
|
||||
// console.log(`iframe = `, iframe);
|
||||
if (iframe == 'true') {
|
||||
data_struct['iframe'] = iframe;
|
||||
|
||||
ae_loc_tmp.iframe = iframe;
|
||||
// data_struct['iframe'] = iframe;
|
||||
ae_loc_tmp.iframe = true;
|
||||
} else if (iframe == 'false') {
|
||||
data_struct['iframe'] = false;
|
||||
// data_struct['iframe'] = false;
|
||||
ae_loc_tmp.iframe = false;
|
||||
}
|
||||
|
||||
@@ -250,62 +149,18 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
// console.log(`ae_loc_tmp = `, ae_loc_tmp);
|
||||
data_struct['ae_loc'] = ae_loc_tmp;
|
||||
|
||||
ae_loc.set(ae_loc_tmp);
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
|
||||
data_struct['ae_ds'] = ds_code_li;
|
||||
|
||||
console.log(`ae_root +layout.ts loading initial DS still...`);
|
||||
// console.log(`ae_root +layout.ts loading initial DS still...`);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// let ae_loc_tmp = get(ae_loc);
|
||||
// let iframe = url.searchParams.get('iframe');
|
||||
// console.log(`iframe = `, iframe);
|
||||
// if (iframe == 'true') {
|
||||
// data_struct['iframe'] = iframe;
|
||||
|
||||
// ae_loc_tmp.iframe = iframe;
|
||||
// } else if (iframe == 'false') {
|
||||
// data_struct['iframe'] = false;
|
||||
// ae_loc_tmp.iframe = false;
|
||||
// }
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
|
||||
|
||||
// if (site_domain_results) {
|
||||
// console.log(`site_domain_results = `, site_domain_results);
|
||||
|
||||
// ae_api['account_id'] = site_domain_results.account_id_random;
|
||||
// // ae_api['headers']['account_id'] = site_domain_results.account_id_random;
|
||||
// ae_api.set(ae_api);
|
||||
// console.log(`ae_api = `, ae_api);
|
||||
|
||||
// ae_core = {
|
||||
// 'account_id': site_domain_results.account_id_random,
|
||||
// 'site_id': site_domain_results.site_id_random,
|
||||
// 'site_domain_id': site_domain_results.site_domain_id_random,
|
||||
// 'enable': site_domain_results.enable,
|
||||
// 'style_href': site_domain_results.style_href,
|
||||
// 'google_tracking_id': site_domain_results.google_tracking_id,
|
||||
// }
|
||||
|
||||
|
||||
// access_code_li_json = handle_get_data_store_obj_w_code({code: 'hub__page__access_code_li_json', data_type: 'json'});
|
||||
|
||||
// if (access_code_li_json) {
|
||||
// console.log(`access_code_li_json = `, access_code_li_json);
|
||||
|
||||
// ae_core = {
|
||||
// ...ae_core,
|
||||
// 'access_code_li': access_code_li_json,
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// data_struct['ae_loc'] = loading_results;
|
||||
console.log(`ae_root +layout.ts load after initial data stores loaded`);
|
||||
// console.log(`ae_root +layout.ts load after initial data stores loaded`);
|
||||
return data_struct;
|
||||
// }
|
||||
|
||||
@@ -313,81 +168,3 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
// console.log(`ae_root +layout.ts load function end`);
|
||||
// return data_struct;
|
||||
}
|
||||
|
||||
|
||||
// async function handle_load_ae_obj_id__site_domain({fqdn, try_cache=false}) {
|
||||
// console.log(`*** handle_load_ae_obj_id__site_domain() *** fqdn=${fqdn}`);
|
||||
|
||||
// let params = {};
|
||||
|
||||
// // ae_loc.hub.site_domain_id_qry_status = 'loading';
|
||||
// let ae_site_domain_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
// api_cfg: get(ae_api),
|
||||
// no_account_id: true,
|
||||
// obj_type: 'site_domain',
|
||||
// obj_id: fqdn, // NOTE: This is the FQDN, not normally the ID.
|
||||
// use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
// use_alt_base: true, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
// params: params,
|
||||
// log_lvl: 0
|
||||
// })
|
||||
// .then(function (site_domain_obj_get_result) {
|
||||
// if (site_domain_obj_get_result) {
|
||||
// // slct.site_domain_obj = site_domain_obj_get_result;
|
||||
// // console.log(`site_domain object:`, get(slct).site_domain_obj);
|
||||
|
||||
// // ae_loc.account_id = $slct.site_domain_obj.account_id_random;
|
||||
// // ae_loc.site_id = $slct.site_domain_obj.site_id_random;
|
||||
// // ae_loc.site_domain_id = $slct.site_domain_obj.site_domain_id_random;
|
||||
// return site_domain_obj_get_result;
|
||||
// } else {
|
||||
// console.log('No results returned.');
|
||||
// return null;
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
|
||||
// return ae_site_domain_obj_get_promise;
|
||||
// }
|
||||
|
||||
// let ds_obj_get_promises: key_val = {};
|
||||
// async function handle_get_data_store_obj_w_code({ code=null, data_type='text' }) {
|
||||
// console.log(`*** handle_get_data_store_obj_w_code() *** code=${code}`);
|
||||
|
||||
// if (!code) {
|
||||
// console.log('No code provided.');
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let data_store_obj_get_promise = api.get_data_store_obj_w_code({
|
||||
// api_cfg: get(ae_api),
|
||||
// data_store_code: code,
|
||||
// data_type: data_type,
|
||||
// log_lvl: 0
|
||||
// })
|
||||
// .then(function (get_data_store_result) {
|
||||
// let return_this = null;
|
||||
// if (get_data_store_result) {
|
||||
|
||||
// if (data_type == 'text') {
|
||||
// // console.log(get_data_store_result.text);
|
||||
// return_this = get_data_store_result.text;
|
||||
// } else if (data_type == 'json') {
|
||||
// // console.log(get_data_store_result.json);
|
||||
// return_this = get_data_store_result.json;
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// console.log('No results returned.');
|
||||
// return_this = null;
|
||||
// }
|
||||
// return return_this;
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
|
||||
// return data_store_obj_get_promise;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user