Files
OSIT-AE-App-Svelte/src/routes/journals/+page.ts
Scott Idem 2f3125c64b style(journals): apply expanded 80-width formatting and snake_case
- Batch formatted all Journals module files using Prettier with printWidth: 80.
- Refactored preventDefault to prevent_default across all Svelte components.
- Standardized line breaks for imports and long attribute lists for better readability.
- Ensured consistent snake_case naming for internal identifiers.
2026-02-06 14:15:43 -05:00

55 lines
1.5 KiB
TypeScript

/** @type {import('./$types').PageLoad} */
// import { error } from '@sveltejs/kit';
import { browser } from '$app/environment';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ fetch, parent }) {
const log_lvl: number = 0;
const parent_data = await parent();
const account_id = parent_data.account_id;
let ae_acct = parent_data[account_id];
if (!ae_acct) {
console.warn(
`ae Journals +page.ts: Account ${account_id} not found in parent data. Initializing ghost acct.`
);
ae_acct = {
api: parent_data.ae_api || {},
loc: {},
slct: {
account_id: account_id
}
};
}
if (browser) {
if (log_lvl) console.log(`ae_journals +page.ts (Non-Blocking)`);
const person_id = ae_acct.loc.person_id;
// OPTIMIZATION: Fire the journal list load in the background.
// Components using LiveQuery (db_journals) will display cached data
// instantly while this refresh runs.
journals_func.load_ae_obj_li__journal({
api_cfg: ae_acct.api,
for_obj_type: 'account',
for_obj_id: account_id,
qry_person_id: person_id,
inc_entry_li: true,
hidden: 'all', // 'not_hidden'
enabled: 'enabled',
limit: 25,
try_cache: true,
log_lvl: 0
});
}
parent_data[account_id] = ae_acct;
return parent_data;
}