diff --git a/src/pages/InvoiceIn/InvoiceInToBook.vue b/src/pages/InvoiceIn/InvoiceInToBook.vue index 5bdbe197b..7bb465d70 100644 --- a/src/pages/InvoiceIn/InvoiceInToBook.vue +++ b/src/pages/InvoiceIn/InvoiceInToBook.vue @@ -56,22 +56,21 @@ async function checkToBook(id) { componentProps: { title: t('Are you sure you want to book this invoice?'), message: messages.reduce((acc, msg) => `${acc}

${msg}

`, ''), + promise: () => toBook(id), }, - }).onOk(() => toBook(id)); + }); } async function toBook(id) { - let type = 'positive'; - let message = t('globals.dataSaved'); - + let err; 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: t('globals.dataSaved') }); } }