Wrapping up for the night at 4 AM. Made lots of progress with the Journals module. Should have saved more often.
This commit is contained in:
58
src/routes/journals/+page.ts
Normal file
58
src/routes/journals/+page.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/** @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({ parent }) {
|
||||
let log_lvl: number = 0;
|
||||
|
||||
let parent_data = await parent();
|
||||
|
||||
let account_id = parent_data.account_id;
|
||||
|
||||
let ae_acct = parent_data[account_id];
|
||||
|
||||
let journal_id = ae_acct.slct.journal_id; // From root +layout.ts
|
||||
if (!journal_id) {
|
||||
if (log_lvl) {
|
||||
console.log(`INFO: journals +layout.ts: The journal_id was not found in the parent_data.`);
|
||||
}
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
if (journal_id) {
|
||||
// let ae_params = {};
|
||||
|
||||
let load_journal_obj_li = journals_func.load_ae_obj_id__journal({
|
||||
api_cfg: ae_acct.api,
|
||||
journal_id: journal_id,
|
||||
// params: ae_params,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
ae_acct.slct.journal_obj_li = load_journal_obj_li;
|
||||
}
|
||||
|
||||
let load_journal_obj_li = await journals_func.load_ae_obj_li__journal({
|
||||
api_cfg: ae_acct.api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
inc_entry_li: true,
|
||||
hidden: 'not_hidden',
|
||||
enabled: 'enabled',
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
limit: 25,
|
||||
// params: ae_params,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
ae_acct.slct.journal_obj_li = load_journal_obj_li;
|
||||
|
||||
}
|
||||
|
||||
parent_data[account_id] = ae_acct;
|
||||
|
||||
return parent_data;
|
||||
}
|
||||
Reference in New Issue
Block a user