Finally getting the initial loading better
This commit is contained in:
@@ -65,94 +65,100 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
console.log(`ERROR: No host found in the URL!!!`);
|
||||
return false;
|
||||
}
|
||||
// ae_loc.url_host = data.url.host; // Use this to look up? sub.example.com:123
|
||||
// ae_loc.fqdn = url.host; // Use this to look up? sub.example.com:123
|
||||
// ae_loc.url_hostname = data.url.hostname; // sub.example.com
|
||||
// ae_loc.url_origin = data.url.origin; // Use this to look up? https://sub.example.com:123
|
||||
// ae_loc.site_domain = data.url.origin;
|
||||
// console.log(`ae_loc = `, ae_loc);
|
||||
// ae_loc.url_host = data.url.host; // Use this to look up? sub.example.com:123
|
||||
// ae_loc.fqdn = url.host; // Use this to look up? sub.example.com:123
|
||||
// ae_loc.url_hostname = data.url.hostname; // sub.example.com
|
||||
// ae_loc.url_origin = data.url.origin; // Use this to look up? https://sub.example.com:123
|
||||
// ae_loc.site_domain = data.url.origin;
|
||||
// console.log(`ae_loc = `, ae_loc);
|
||||
|
||||
// const res = await fetch(`https://api.example.com/data`);
|
||||
// const res = await fetch(`https://api.example.com/data`);
|
||||
|
||||
loading_results = await core_func.handle_load_ae_obj_id__site_domain({api_cfg: ae_api_tmp, fqdn: url.host, try_cache: false})
|
||||
loading_results = await core_func.handle_load_ae_obj_id__site_domain({api_cfg: ae_api_tmp, fqdn: url.host, try_cache: false})
|
||||
|
||||
.then(function (site_domain_results) {
|
||||
if (site_domain_results) {
|
||||
// console.log(`ae_ site_domain_results = `, site_domain_results);
|
||||
.then(function (site_domain_results) {
|
||||
if (site_domain_results) {
|
||||
// console.log(`ae_ site_domain_results = `, site_domain_results);
|
||||
|
||||
// ae_api_tmp = get(ae_api);
|
||||
// ae_api_tmp = get(ae_api);
|
||||
|
||||
ae_api_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
ae_api_tmp['headers']['x-account-id'] = site_domain_results.account_id_random;
|
||||
ae_api_tmp['headers']['x-no-account-id'] = null;
|
||||
ae_api_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
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);
|
||||
// console.log(`ae_api = `, get(ae_api));
|
||||
// ae_api.set(ae_api_tmp);
|
||||
// console.log(`ae_api = `, get(ae_api));
|
||||
|
||||
ae_loc_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
ae_loc_tmp['site_id'] = site_domain_results.site_id_random;
|
||||
ae_loc_tmp['site_domain_id'] = site_domain_results.site_domain_id_random;
|
||||
ae_loc_tmp['site_enable'] = site_domain_results.enable;
|
||||
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;
|
||||
}
|
||||
ae_loc_tmp['account_id'] = site_domain_results.account_id_random;
|
||||
ae_loc_tmp['site_id'] = site_domain_results.site_id_random;
|
||||
ae_loc_tmp['site_domain_id'] = site_domain_results.site_domain_id_random;
|
||||
ae_loc_tmp['site_enable'] = site_domain_results.enable;
|
||||
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;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
return true;
|
||||
})
|
||||
.then(async function (results) {
|
||||
|
||||
.then(async function (results) {
|
||||
return true;
|
||||
})
|
||||
.finally(function () {
|
||||
|
||||
ds_code = 'hub__page__access_code_li_json';
|
||||
await core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_api_tmp, code: ds_code, data_type: 'json'})
|
||||
.then(function (access_code_li_json_results) {
|
||||
if (access_code_li_json_results) {
|
||||
// console.log(`ae_ access_code_li_json_results = `, access_code_li_json_results);
|
||||
|
||||
// ae_loc_tmp = get(ae_loc);
|
||||
ae_loc_tmp = {
|
||||
...ae_loc_tmp,
|
||||
'access_code_li': access_code_li_json_results,
|
||||
}
|
||||
|
||||
// ae_loc_tmp = get(ae_loc);
|
||||
// let code = 'hub__page__access_code_li_json';
|
||||
|
||||
ds_code_li[ds_code] = access_code_li_json_results;
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
})
|
||||
|
||||
.finally(function () {
|
||||
|
||||
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
||||
// ae_loc_tmp = {
|
||||
// ...ae_loc_tmp,
|
||||
// 'ds': ds_code_li,
|
||||
// }
|
||||
// console.log(`ae_ ds_code_li = `, ds_code_li);
|
||||
// ae_loc_tmp = {
|
||||
// ...ae_loc_tmp,
|
||||
// 'ds': ds_code_li,
|
||||
// }
|
||||
|
||||
|
||||
// console.log(`ae_loc_tmp = `, ae_loc_tmp);
|
||||
data_struct['ae_loc'] = ae_loc_tmp;
|
||||
// console.log(`ae_loc_tmp = `, ae_loc_tmp);
|
||||
// data_struct['ae_loc'] = ae_loc_tmp;
|
||||
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
// ae_loc.set(ae_loc_tmp);
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
|
||||
data_struct['ae_ds'] = ds_code_li;
|
||||
// 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;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
// data_struct['ae_loc'] = loading_results;
|
||||
// console.log(`ae_root +layout.ts load after initial data stores loaded`);
|
||||
return data_struct;
|
||||
let ds_type: null|string = 'json';
|
||||
ds_code = 'hub__page__access_code_li_json';
|
||||
ds_code_li[ds_code] = await core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_api_tmp, code: ds_code, data_type: ds_type})
|
||||
.then(function (ds_results) {
|
||||
if (ds_results) {
|
||||
console.log(`ae_ ds_results = `, ds_results);
|
||||
return ds_results;
|
||||
|
||||
// // ae_loc_tmp = get(ae_loc);
|
||||
// ae_loc_tmp['access_code_li'] = ds_results;
|
||||
// // ae_loc_tmp = {
|
||||
// // ...ae_loc_tmp,
|
||||
// // 'access_code_li': ds_results,
|
||||
// // }
|
||||
|
||||
// // ae_loc_tmp = get(ae_loc);
|
||||
// // let code = 'hub__page__access_code_li_json';
|
||||
|
||||
// ds_code_li[ds_code] = ds_results;
|
||||
// // ae_loc.set(ae_loc_tmp);
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
data_struct['ae_ds'] = ds_code_li;
|
||||
ae_loc_tmp['access_code_li'] = ds_code_li;
|
||||
data_struct['ae_loc'] = ae_loc_tmp;
|
||||
|
||||
// data_struct['ae_loc'] = loading_results;
|
||||
// console.log(`ae_root +layout.ts load after initial data stores loaded`);
|
||||
return data_struct;
|
||||
// }
|
||||
|
||||
// Currently we should never make it to this point! 2024-03-06
|
||||
|
||||
Reference in New Issue
Block a user