From a07f5b7d1cb2099d8d369fd925685ef171911070 Mon Sep 17 00:00:00 2001 From: Jonas Rittershofer Date: Thu, 14 May 2020 15:23:26 +0200 Subject: [PATCH] Delete empty options from Db Signed-off-by: Jonas Rittershofer --- src/components/Questions/AnswerInput.vue | 15 +--- src/components/Questions/QuestionMultiple.vue | 68 +++++++++++++++---- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/src/components/Questions/AnswerInput.vue b/src/components/Questions/AnswerInput.vue index 6e28b9c..c7fc60d 100644 --- a/src/components/Questions/AnswerInput.vue +++ b/src/components/Questions/AnswerInput.vue @@ -114,21 +114,8 @@ export default { // Dismiss delete key action e.preventDefault() - const answer = Object.assign({}, this.answer) - const index = this.index - if (!answer.local) { - // let's not await, deleting in background - axios.delete(generateUrl('/apps/forms/api/v1/option/{id}', { id: this.answer.id })) - .catch(error => { - showError(t('forms', 'There was an issue deleting this option')) - console.error(error) - // restore option - this.$emit('restore', answer, index) - }) - } - - this.$emit('delete', answer.id, index) + this.$emit('delete', this.answer.id) }, /** diff --git a/src/components/Questions/QuestionMultiple.vue b/src/components/Questions/QuestionMultiple.vue index b433942..2184490 100644 --- a/src/components/Questions/QuestionMultiple.vue +++ b/src/components/Questions/QuestionMultiple.vue @@ -61,9 +61,8 @@ :index="index" :max-option-length="maxStringLengths.optionText" @add="addNewEntry" - @delete="deleteAnswer" - @update:answer="updateAnswer" - @restore="restoreAnswer" /> + @delete="deleteOption" + @update:answer="updateAnswer" />
  • @@ -81,6 +80,10 @@