fix: refs #8388 improve error handling and notification for invoice booking
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
af0a672356
commit
01d1ca83ea
|
@ -56,22 +56,21 @@ async function checkToBook(id) {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
title: t('Are you sure you want to book this invoice?'),
|
title: t('Are you sure you want to book this invoice?'),
|
||||||
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
|
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
|
||||||
|
promise: () => toBook(id),
|
||||||
},
|
},
|
||||||
}).onOk(() => toBook(id));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toBook(id) {
|
async function toBook(id) {
|
||||||
let type = 'positive';
|
let err;
|
||||||
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: t('globals.dataSaved') });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue