Should have saved my progress earlier. Trying to redo things without using localStorage initially. Shared data...

This commit is contained in:
Scott Idem
2024-03-27 11:36:06 -04:00
parent a8a2131361
commit 3082c07e3e
5 changed files with 109 additions and 33 deletions

View File

@@ -17,7 +17,9 @@ async function handle_load_ae_obj_id__site_domain({ api_cfg, fqdn, try_cache=fal
let no_account_id = false;
if (!api_cfg.account_id) {
no_account_id = true;
// api_cfg.headers['x_account_id'] = 'nothing here';
}
no_account_id = true;
let params = {};
@@ -30,7 +32,7 @@ async function handle_load_ae_obj_id__site_domain({ api_cfg, fqdn, try_cache=fal
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: 1
log_lvl: 0
})
.then(function (site_domain_obj_get_result) {
if (site_domain_obj_get_result) {

View File

@@ -137,7 +137,7 @@ export let ae_app_local_data_struct: key_val = {
'testing': {},
},
}
console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct);
// console.log(`AE Stores - App Local Storage Data:`, ae_app_local_data_struct);
// This works, but does not uses local storage:
// export let ae_loc = writable(ae_app_local_data_struct);

View File

@@ -92,12 +92,10 @@ export let get_object = async function get_object({api_cfg, endpoint='', headers
/* other custom settings */
});
axios_api.defaults.headers = api_cfg['headers'];
console.log(axios_api.defaults.headers);
console.log('axios_api.defaults.headers:', axios_api.defaults.headers);
console.log('Additional headers:', headers);
// console.log(headers);
console.log('Clean the headers. No _underscores_!')
// console.log('Clean the headers. No _underscores_!')
let headers_cleaned = {};
for (const prop in headers) {
// No underscores allowed in the header parameters!
@@ -115,7 +113,7 @@ export let get_object = async function get_object({api_cfg, endpoint='', headers
}
}
headers = headers_cleaned;
console.log('Cleaned additional headers:', headers);
console.log('All headers cleaned:', headers);
console.log('URL params:');
for (const prop in params) {
@@ -152,7 +150,7 @@ export let get_object = async function get_object({api_cfg, endpoint='', headers
let percent_completed = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
console.log('GET Data Timestamp:', progressEvent.timeStamp, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
// console.log('GET Data Timestamp:', progressEvent.timeStamp, 'Total:', progressEvent.total, 'Loaded:', progressEvent.loaded, 'Percent Completed', percent_completed);
temp_get_object_percent_completed = percent_completed;
}
@@ -615,7 +613,17 @@ export let get_ae_obj_id_crud = async function get_ae_obj_id_crud({
if (no_account_id) {
headers['x-no-account-id'] = 'Nothing to See Here';
delete headers['x-account-id'];
delete api_cfg['headers']['x-account-id'];
// headers['x-account-id'] = null;
// headers['x-account-id'] = '_XY7DXtc9Mxx';
// params['x_no_account_id_token'] = 'Nothing to See Here';
// Remove the x-account-id header
// if (headers['x-account-id']) {
// delete headers['x-account-id'];
// }
// headers['x-account-id'] = null;
// headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes
}
@@ -1328,13 +1336,13 @@ export let get_data_store_obj_w_code = async function get_data_store_obj_w_code(
if (data_store_obj_get_promise === false) {
console.log('Data Store - RUN AGAIN WITH BACKUP');
let original_api_base_url = api_cfg['base_url'];
// let original_api_base_url = api_cfg['base_url'];
let temp_api = api_cfg;
temp_api['base_url'] = temp_api['base_url_bak']
// let temp_api = api_cfg;
// temp_api['base_url'] = temp_api['base_url_bak']
data_store_obj_get_promise = await api.get_object({api_cfg: temp_api, endpoint: endpoint, headers: headers, params: params, timeout: 6000, log_lvl: log_lvl});
temp_api['base_url'] = original_api_base_url;
// data_store_obj_get_promise = await api.get_object({api_cfg: temp_api, endpoint: endpoint, headers: headers, params: params, timeout: 6000, log_lvl: log_lvl});
// temp_api['base_url'] = original_api_base_url;
}
let data_store_obj = data_store_obj_get_promise;