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 b110c315 authored by Hermann's avatar Hermann
Browse files

simplify code structure

parent 12e0f27f
......@@ -193,16 +193,19 @@ 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) {
// first upload the data as JSON, then the images as form data
this.submit(data).then(({ _id, _etag }) => {
// first upload the data as JSON, then the images as form data
this.submit(data).then(({ _id, _etag }) => {
if (Object.keys(images).length > 0) {
// there are changed images to upload, they are added as an additional PATCH on this event
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).then(() => this.controller.changeModus('view'));
});
} else this.submit(data).then(() => this.controller.changeModus('view'));
} else {
this.controller.changeModus('view');
}
});
} else {
// Propose tool
Dialog.show({
......
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