refactor: juan changes
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-14 09:30:09 +02:00
parent 50ec41dece
commit 5918b3e0df
1 changed files with 6 additions and 5 deletions

View File

@ -62,6 +62,7 @@ class Controller extends Dialog {
this.vnApp.showSuccess(this.$t('Data saved!'));
});
this.$.invoiceButton.disabled = true;
return this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice)
.then(async res => {
const clientsAndAddresses = res.data.clientsAndAddresses;
@ -69,7 +70,6 @@ class Controller extends Dialog {
if (!clientsAndAddresses.length) return super.responseHandler(response);
this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId;
this.$.invoiceButton.setAttribute('disabled', true);
for (let clientAndAddress of clientsAndAddresses) {
this.currentClientId = clientAndAddress.clientId;
const params = {
@ -93,13 +93,14 @@ class Controller extends Dialog {
.then(() => super.responseHandler(response))
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
.finally(() => {
this.lastClientId = null;
this.$.invoiceButton.removeAttribute('disabled');
this.lastClientId = null; // unificar en una función
this.$.invoiceButton.disabled = false; // unificar en una función
});
} catch (e) {
this.vnApp.showError(this.$t(e.message));
this.lastClientId = null;
this.$.invoiceButton.removeAttribute('disabled');
this.lastClientId = null; // unificar en una función
this.$.invoiceButton.disabled = false; // unificar en una función
throw e;
return false;
}
}