Added check in case the Journal Entry creation fails
This commit is contained in:
@@ -243,12 +243,18 @@ async function handle_update_journal() {
|
|||||||
}).then((results) => {
|
}).then((results) => {
|
||||||
console.log('New journal entry created:', results);
|
console.log('New journal entry created:', results);
|
||||||
$journals_slct.journal_entry_id = results?.journal_entry_id_random;
|
$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] = true;
|
||||||
// alert(`Journal entry created successfully! ${$journals_slct.journal_entry_id}`);
|
// alert(`Journal entry created successfully! ${$journals_slct.journal_entry_id}`);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error('Error updating journal entry:', error);
|
console.error('Error updating journal entry:', error);
|
||||||
alert('Failed to update journal entry.');
|
alert('Failed to update journal entry.');
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
goto(`/journals/${$lq__journal_obj?.journal_id}/entry/${$journals_slct.journal_entry_id}`);
|
if ($journals_slct.journal_entry_id) {
|
||||||
|
goto(`/journals/${$lq__journal_obj?.journal_id}/entry/${$journals_slct.journal_entry_id}`);
|
||||||
|
} else {
|
||||||
|
alert('Failed to create new journal entry.');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
class="
|
class="
|
||||||
|
|||||||
Reference in New Issue
Block a user