Less debug. Code clean up. And it uses the Svelte fetch function!! I think it just works...

This commit is contained in:
Scott Idem
2025-05-07 19:49:27 -04:00
parent 7af1d41ff3
commit df3b455c18
7 changed files with 47 additions and 22 deletions

View File

@@ -57,7 +57,9 @@ let lq__journal_obj = $derived(liveQuery(async () => {
.get($journals_slct?.journal_id ?? ''); // null or undefined does not reset things like '' does
$journals_slct.journal_obj = results;
console.log(`lq__journal_obj: results = `, results);
if (log_lvl) {
console.log(`lq__journal_obj: results = `, results);
}
return results;
}));
@@ -95,7 +97,9 @@ async function handle_update_journal() {
data_kv: data_kv,
log_lvl: log_lvl
}).then((results) => {
console.log('Journal updated:', results);
if (log_lvl) {
console.log('Journal updated:', results);
}
// $journals_slct.journal_id = results?.journal_id_random;
}).catch((error) => {
console.error('Error updating journal:', error);
@@ -245,7 +249,9 @@ async function handle_update_journal() {
data_kv: data_kv,
log_lvl: log_lvl
}).then((results) => {
console.log('New journal entry created:', results);
if (log_lvl) {
console.log('New journal entry created:', results);
}
$journals_slct.journal_entry_id = results?.journal_entry_id_random;
// $journals_loc.entry.edit = true;
$journals_loc.entry.edit_kv[$journals_slct.journal_entry_id] = 'current';
@@ -299,7 +305,7 @@ async function handle_update_journal() {
title="Select a category for the new journal entry"
>
<option value="">Select Category</option>
{#each $lq__journal_obj?.cfg_json.category_li as category}
{#each $lq__journal_obj?.cfg_json?.category_li as category}
<option value={category.code}>{category.name}</option>
{/each}
</select>