More general code clean up. More removing of the _random bits.
This commit is contained in:
@@ -69,7 +69,7 @@
|
||||
api_cfg: $ae_api,
|
||||
account_id: $slct.account_id,
|
||||
data_kv: {
|
||||
person_id_random: $ae_loc.person_id,
|
||||
person_id: $ae_loc.person_id,
|
||||
name,
|
||||
type_code: type,
|
||||
cfg_json: {
|
||||
@@ -77,9 +77,9 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
if (results?.journal_id_random) {
|
||||
if (results?.journal_id) {
|
||||
$journals_sess.show__modal_new__journal_obj = false;
|
||||
goto(`/journals/${results.journal_id_random}`);
|
||||
goto(`/journals/${results.journal_id}`);
|
||||
}
|
||||
} catch (error) {
|
||||
alert('Failed to create journal.');
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
});
|
||||
|
||||
local_ids = local_results
|
||||
.map((e) => e.id || e.journal_entry_id_random)
|
||||
.map((e) => e.id || e.journal_entry_id)
|
||||
.filter(Boolean);
|
||||
|
||||
if (current_search_id === last_search_id) {
|
||||
@@ -235,7 +235,7 @@
|
||||
if (current_search_id === last_search_id) {
|
||||
const api_results = results || [];
|
||||
const api_ids = api_results
|
||||
.map((e: any) => e.id || e.journal_entry_id_random)
|
||||
.map((e: any) => e.id || e.journal_entry_id)
|
||||
.filter(Boolean);
|
||||
|
||||
// Protect UI cache if API returns empty during revalidation
|
||||
|
||||
@@ -4,11 +4,6 @@ console.log(`ae_p_journals [journal_entry_id] +page.ts start`);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
import {
|
||||
db_journals,
|
||||
journal_entry_field_li
|
||||
} from '$lib/ae_journals/db_journals';
|
||||
import { load_ae_obj_id } from '$lib/ae_core/core__crud_generic';
|
||||
|
||||
export async function load({ params, parent }) {
|
||||
// route
|
||||
@@ -68,15 +63,6 @@ export async function load({ params, parent }) {
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
// const load_journal_entry_obj = await load_ae_obj_id({
|
||||
// api_cfg: ae_acct.api,
|
||||
// obj_type: 'journal_entry',
|
||||
// obj_id: journal_entry_id,
|
||||
// db_instance: db_journals,
|
||||
// db_field_li: journal_entry_field_li,
|
||||
// log_lvl: 2
|
||||
// });
|
||||
|
||||
if (!load_journal_entry_obj) {
|
||||
console.warn(
|
||||
`ae Journals [journal_entry_id] +page.ts: Entry ${journal_entry_id} not found via API or Cache.`
|
||||
|
||||
@@ -382,14 +382,14 @@
|
||||
})
|
||||
.then((result) => {
|
||||
if (
|
||||
result?.journal_id_random &&
|
||||
result?.journal_entry_id_random
|
||||
result?.journal_id &&
|
||||
result?.journal_entry_id
|
||||
) {
|
||||
alert(
|
||||
'Journal entry cloned successfully!'
|
||||
);
|
||||
goto(
|
||||
`/journals/${result.journal_id_random}/entry/${result.journal_entry_id_random}`
|
||||
`/journals/${result.journal_id}/entry/${result.journal_entry_id}`
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -156,13 +156,13 @@
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (results?.journal_entry_id_random) {
|
||||
if (results?.journal_entry_id) {
|
||||
$journals_slct.journal_entry_id =
|
||||
results.journal_entry_id_random;
|
||||
results.journal_entry_id;
|
||||
$journals_loc.entry.edit_kv[$journals_slct.journal_entry_id] =
|
||||
'current';
|
||||
goto(
|
||||
`/journals/${$lq__journal_obj?.journal_id}/entry/${results.journal_entry_id_random}`
|
||||
`/journals/${$lq__journal_obj?.journal_id}/entry/${results.journal_entry_id}`
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user