Hardened Journals and IDAA module load functions for offline resilience and ghost account support.
This commit is contained in:
@@ -13,7 +13,17 @@ export async function load({ fetch, params, parent }) {
|
||||
data.log_lvl = log_lvl;
|
||||
|
||||
const account_id = data.account_id;
|
||||
const ae_acct = data[account_id];
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
if (!ae_acct) {
|
||||
console.warn(`ae IDAA Archives +layout.ts: Account ${account_id} not found in data. Initializing ghost acct.`);
|
||||
ae_acct = {
|
||||
api: data.ae_api || {},
|
||||
slct: {
|
||||
account_id: account_id
|
||||
}
|
||||
};
|
||||
}
|
||||
// console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
// if (!account_id) {
|
||||
|
||||
@@ -14,7 +14,17 @@ export const load = (async ({ params, parent }) => {
|
||||
data.log_lvl = log_lvl;
|
||||
|
||||
const account_id = data.account_id;
|
||||
const ae_acct = data[account_id];
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
if (!ae_acct) {
|
||||
console.warn(`ae IDAA Bulletin Board +page.ts: Account ${account_id} not found in parent data. Initializing ghost acct.`);
|
||||
ae_acct = {
|
||||
api: data.ae_api || {},
|
||||
slct: {
|
||||
account_id: account_id
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
const load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||
|
||||
@@ -13,7 +13,17 @@ export async function load({ params, parent }) {
|
||||
data.log_lvl = log_lvl;
|
||||
|
||||
const account_id = data.account_id;
|
||||
const ae_acct = data[account_id];
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
if (!ae_acct) {
|
||||
console.warn(`ae IDAA Recovery Meetings +layout.ts: Account ${account_id} not found in data. Initializing ghost acct.`);
|
||||
ae_acct = {
|
||||
api: data.ae_api || {},
|
||||
slct: {
|
||||
account_id: account_id
|
||||
}
|
||||
};
|
||||
}
|
||||
// console.log(`ae_acct = `, ae_acct);
|
||||
|
||||
// if (!account_id) {
|
||||
|
||||
@@ -14,7 +14,17 @@ export const load = (async ({ params, parent }) => {
|
||||
data.log_lvl = log_lvl;
|
||||
|
||||
const account_id = data.account_id;
|
||||
const ae_acct = data[account_id];
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
if (!ae_acct) {
|
||||
console.warn(`ae IDAA Recovery Meeting [event_id] +page.ts: Account ${account_id} not found in data. Initializing ghost acct.`);
|
||||
ae_acct = {
|
||||
api: data.ae_api || {},
|
||||
slct: {
|
||||
account_id: account_id
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const event_id = params.event_id;
|
||||
|
||||
@@ -30,21 +40,26 @@ export const load = (async ({ params, parent }) => {
|
||||
api_cfg: ae_acct.api,
|
||||
event_id: event_id,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then((results) => {
|
||||
if (!results) {
|
||||
error(404, {
|
||||
message: 'IDAA Recovery Meetings - Event not found'
|
||||
});
|
||||
} else {
|
||||
// ae_acct.slct.event_obj = results;
|
||||
}
|
||||
});
|
||||
// .then((results) => {
|
||||
// if (!results) {
|
||||
// error(404, {
|
||||
// message: 'IDAA Recovery Meetings - Event not found'
|
||||
// });
|
||||
// } else {
|
||||
// // ae_acct.slct.event_obj = results;
|
||||
// }
|
||||
// });
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_obj = `, load_event_obj);
|
||||
}
|
||||
ae_acct.slct.event_obj = load_event_obj;
|
||||
|
||||
if (!load_event_obj) {
|
||||
console.warn(`ae IDAA Recovery Meeting [event_id] +page.ts: Event ${event_id} not found via API or Cache.`);
|
||||
} else {
|
||||
ae_acct.slct.event_obj = load_event_obj;
|
||||
}
|
||||
}
|
||||
|
||||
// WARNING: Precaution against shared data between sites and presentations.
|
||||
|
||||
Reference in New Issue
Block a user