fix: refs #8581 improve error handling in toBook function
gitea/salix-front/pipeline/pr-dev Build queued... Details

This commit is contained in:
Jorge Penadés 2025-03-14 10:46:58 +01:00
parent d31ea18c0d
commit 4ec7212d30
1 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnConfirm from 'src/components/ui/VnConfirm.vue'; import VnConfirm from 'src/components/ui/VnConfirm.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import qs from 'qs';
const { notify, dialog } = useQuasar(); const { notify, dialog } = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
@ -61,17 +61,17 @@ async function checkToBook(id) {
} }
async function toBook(id) { async function toBook(id) {
let type = 'positive'; let err = false;
let message = t('globals.dataSaved'); let message = t('globals.dataSaved');
try { try {
await axios.post(`InvoiceIns/${id}/toBook`); await axios.post(`InvoiceIns/${id}/toBook`);
store.data.isBooked = true; store.data.isBooked = true;
} catch (e) { } catch (e) {
type = 'negative'; err = true;
message = t('It was not able to book the invoice'); throw e;
} finally { } finally {
notify({ type, message }); if (!err) notify({ type: 'positive', message });
} }
} }
</script> </script>