refactor: delete counter
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-10-20 07:58:38 +02:00
parent 39f4445172
commit 53112995bc
1 changed files with 2 additions and 3 deletions

View File

@ -51,7 +51,7 @@ class Controller extends Dialog {
} }
invoiceOut(invoice, clientsAndAddresses) { invoiceOut(invoice, clientsAndAddresses) {
const clientAndAddress = clientsAndAddresses[this.pos]; const [clientAndAddress] = clientsAndAddresses;
if (!clientAndAddress) return; if (!clientAndAddress) return;
this.currentClientId = clientAndAddress.clientId; this.currentClientId = clientAndAddress.clientId;
const params = { const params = {
@ -70,7 +70,7 @@ class Controller extends Dialog {
return this.$http.post(`InvoiceOuts/invoiceClient`, params, options) return this.$http.post(`InvoiceOuts/invoiceClient`, params, options)
.then(() => { .then(() => {
this.pos++; clientsAndAddresses.shift();
return this.invoiceOut(invoice, clientsAndAddresses); return this.invoiceOut(invoice, clientsAndAddresses);
}); });
} }
@ -100,7 +100,6 @@ class Controller extends Dialog {
const clientsAndAddresses = res.data.clientsAndAddresses; const clientsAndAddresses = res.data.clientsAndAddresses;
if (!clientsAndAddresses.length) return super.responseHandler(response); if (!clientsAndAddresses.length) return super.responseHandler(response);
this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId; this.lastClientId = clientsAndAddresses[clientsAndAddresses.length - 1].clientId;
this.pos = 0;
return this.invoiceOut(invoice, clientsAndAddresses); return this.invoiceOut(invoice, clientsAndAddresses);
}) })
.then(() => super.responseHandler(response)) .then(() => super.responseHandler(response))