From dc62841c3d72950e12717321d80144c3929a2890 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Oct 2022 14:46:40 +0200 Subject: [PATCH] refator: trying to delete async and await --- .../front/index/global-invoicing/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/invoiceOut/front/index/global-invoicing/index.js b/modules/invoiceOut/front/index/global-invoicing/index.js index e311f6b020..ef05c77843 100644 --- a/modules/invoiceOut/front/index/global-invoicing/index.js +++ b/modules/invoiceOut/front/index/global-invoicing/index.js @@ -50,6 +50,14 @@ class Controller extends Dialog { this.$.invoiceButton.disabled = false; } + invoice() { + const clientAndAddress = clientsAndAddresses[this.pos]; + return this.post(`InvoiceOuts/globalInvoicing`, params, options).then(() => { + this.pos++; + this.invoice(); + }); + } + async responseHandler(response) { try { if (response !== 'accept') @@ -69,7 +77,10 @@ class Controller extends Dialog { this.$.invoiceButton.disabled = true; if (this.clientsNumber == 'allClients') this.getMaxClientId(); - return this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice) + this.pos = 0; + this.invoice(); + + this.$http.post(`InvoiceOuts/clientToInvoice`, this.invoice) .then(async res => { const invoice = res.data.invoice; const clientsAndAddresses = res.data.clientsAndAddresses; @@ -91,7 +102,7 @@ class Controller extends Dialog { const options = { timeout: this.canceler.promise }; - await this.$http.post(`InvoiceOuts/globalInvoicing`, params, options); + await this.$http.post(`InvoiceOuts/globalInvoicing`, params, options).then(); } }) .then(() => super.responseHandler(response))