From b7a767cfae26d22ac080033d74f3b2bb0d419982 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 1 Oct 2020 18:25:57 +0200 Subject: [PATCH] Make sure we don't submit the event form twice Signed-off-by: Thomas Citharel --- js/src/views/Event/Edit.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/src/views/Event/Edit.vue b/js/src/views/Event/Edit.vue index d55791315..950a435c2 100644 --- a/js/src/views/Event/Edit.vue +++ b/js/src/views/Event/Edit.vue @@ -267,13 +267,18 @@ - {{ - $t("Save draft") - }} + {{ $t("Save draft") }} @@ -457,6 +462,8 @@ export default class EditEvent extends Vue { endsOnNull = false; + saving = false; + displayNameAndUsername = displayNameAndUsername; formatList = formatList; @@ -517,6 +524,7 @@ export default class EditEvent extends Vue { } createOrUpdatePublish(e: Event): void { + e.preventDefault(); if (this.validateForm()) { this.event.draft = false; this.createOrUpdateDraft(e); @@ -552,6 +560,7 @@ export default class EditEvent extends Vue { } async createEvent(): Promise { + this.saving = true; const variables = await this.buildVariables(); try { @@ -575,11 +584,13 @@ export default class EditEvent extends Vue { params: { uuid: data.createEvent.uuid }, }); } catch (err) { + this.saving = false; console.error(err); } } async updateEvent(): Promise { + this.saving = true; const variables = await this.buildVariables(); try { @@ -601,6 +612,7 @@ export default class EditEvent extends Vue { params: { uuid: this.eventId as string }, }); } catch (err) { + this.saving = false; console.error(err); } }