diff --git a/modules/route/front/agency-term/createInvoiceIn/index.js b/modules/route/front/agency-term/createInvoiceIn/index.js index 7ab8adbfa..0198ab80f 100644 --- a/modules/route/front/agency-term/createInvoiceIn/index.js +++ b/modules/route/front/agency-term/createInvoiceIn/index.js @@ -62,6 +62,7 @@ class Controller extends Section { } onSubmit() { + if (this.dms.files.length > 1) throw new UserError('You cannot attach more than one document'); const query = `dms/uploadFile`; const options = { method: 'POST', @@ -72,10 +73,7 @@ class Controller extends Section { }, transformRequest: files => { const formData = new FormData(); - - for (let i = 0; i < files.length; i++) - formData.append(files[i].name, files[i]); - + formData.append(files[0].name, files[0]); return formData; }, data: this.dms.files @@ -83,7 +81,6 @@ class Controller extends Section { this.$http(options).then(res => { if (res) { const addedDms = res.data; - if (addedDms.length > 1) throw new UserError('You cannot attach more than one document'); this.$.watcher.updateOriginalData(); const params = {