Improve naming conventions. Fail route first, then happy route. Abstract invoice no generation. Fix nested items validation.

This commit is contained in:
HenriT
2021-02-16 21:14:48 +02:00
parent 05b2a3f358
commit de779eda8a
3 changed files with 49 additions and 33 deletions

View File

@ -131,7 +131,7 @@ export default {
commit('clearErrors');
return InvoiceService.updateInvoice(getters.invoice)
.catch(err => commit('setErrors', err.response.data.errors));
.catch(err => commit('setErrors', err.errors));
},
async deleteInvoice(invoice) {
const res = await InvoiceService.deleteInvoice(invoice.id);
@ -161,11 +161,9 @@ export default {
commit('clearErrors');
try {
console.log('tryBookInvoice');
const res = await InvoiceService.bookInvoice(getters.invoice);
return dispatch('getInvoice', res.invoice_id);
} catch (err) {
console.log(err);
commit('setErrors', err.errors);
}
},