To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 6d9503ce authored by Hermann's avatar Hermann
Browse files

minor corrections

parent 60283125
......@@ -194,13 +194,13 @@ export default class newEvent extends EditView {
// Change moderator from user object to user id
if (data.moderator) data.moderator = data.moderator._id;
if (Object.keys(images).length > 0) {
const imageForm = new FormData();
Object.keys(images).forEach(key => imageForm.append(key, images[key]));
// first upload the data as JSON, then the images as form data
this.submit(this.form.data).then(({ _id, _etag }) => {
this.submit(data).then(({ _id, _etag }) => {
const imageForm = new FormData();
Object.keys(images).forEach(key => imageForm.append(key, images[key]));
imageForm.append('_id', _id);
imageForm.append('_etag', _etag);
this.controller.patch(imageForm, true);
this.controller.patch(imageForm);
});
} else this.submit(data);
} else {
......
......@@ -32,11 +32,11 @@ export default class ItemController {
});
}
patch(data, formData = false) {
patch(data) {
return new Promise((resolve, reject) => {
this.handler.patch(data, formData).then((response) => {
this.changeModus('view');
this.handler.patch(data).then((response) => {
resolve(response);
this.changeModus('view');
}).catch(reject);
});
}
......
......@@ -64,7 +64,6 @@ export default class EditView extends ItemView {
request = this.controller.post(data);
}
request.then((response) => {
console.log(response);
resolve(response);
}).catch((error) => {
console.log(error);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment