From 4ec7212d30281e91450724b73f84676eedf3b530 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 14 Mar 2025 10:46:58 +0100 Subject: [PATCH] fix: refs #8581 improve error handling in toBook function --- src/pages/InvoiceIn/InvoiceInToBook.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/InvoiceIn/InvoiceInToBook.vue b/src/pages/InvoiceIn/InvoiceInToBook.vue index 5bdbe197b..ef4fdcce0 100644 --- a/src/pages/InvoiceIn/InvoiceInToBook.vue +++ b/src/pages/InvoiceIn/InvoiceInToBook.vue @@ -4,7 +4,7 @@ import { useQuasar } from 'quasar'; import { useI18n } from 'vue-i18n'; import VnConfirm from 'src/components/ui/VnConfirm.vue'; import { useArrayData } from 'src/composables/useArrayData'; -import qs from 'qs'; + const { notify, dialog } = useQuasar(); const { t } = useI18n(); @@ -61,17 +61,17 @@ async function checkToBook(id) { } async function toBook(id) { - let type = 'positive'; + let err = false; let message = t('globals.dataSaved'); try { await axios.post(`InvoiceIns/${id}/toBook`); store.data.isBooked = true; } catch (e) { - type = 'negative'; - message = t('It was not able to book the invoice'); + err = true; + throw e; } finally { - notify({ type, message }); + if (!err) notify({ type: 'positive', message }); } }