fix: check cannot attach more than one file
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d22be6620c
commit
b58020978a
|
@ -62,6 +62,7 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
if (this.dms.files.length > 1) throw new UserError('You cannot attach more than one document');
|
||||||
const query = `dms/uploadFile`;
|
const query = `dms/uploadFile`;
|
||||||
const options = {
|
const options = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -72,10 +73,7 @@ class Controller extends Section {
|
||||||
},
|
},
|
||||||
transformRequest: files => {
|
transformRequest: files => {
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
formData.append(files[0].name, files[0]);
|
||||||
for (let i = 0; i < files.length; i++)
|
|
||||||
formData.append(files[i].name, files[i]);
|
|
||||||
|
|
||||||
return formData;
|
return formData;
|
||||||
},
|
},
|
||||||
data: this.dms.files
|
data: this.dms.files
|
||||||
|
@ -83,7 +81,6 @@ class Controller extends Section {
|
||||||
this.$http(options).then(res => {
|
this.$http(options).then(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
const addedDms = res.data;
|
const addedDms = res.data;
|
||||||
if (addedDms.length > 1) throw new UserError('You cannot attach more than one document');
|
|
||||||
this.$.watcher.updateOriginalData();
|
this.$.watcher.updateOriginalData();
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|
Loading…
Reference in New Issue