From 309669558dfd5a47747f1a5686271e5a293a41ab Mon Sep 17 00:00:00 2001 From: Dat Date: Thu, 11 Jan 2024 00:45:25 +0100 Subject: [PATCH] fix: delete QA bundle before saving --- .../Pages/ManageWiki/Cards/QuestyCaptcha.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue index 52c185c4..e8790d70 100644 --- a/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue +++ b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue @@ -127,7 +127,7 @@ export default { }, removeQuestion (index) { this.questionsFromStore.splice(index, 1) - + // hide trash icon when there is just one QA bundle if (this.questionsFromStore.length === 1) { this.showIcon = false } @@ -137,12 +137,16 @@ export default { question: '', answers: [] }) - - if (this.questionsFromStore.length > 1) { - this.showIcon = true - } + // show the trash icon again when there are more than one QA bundle + this.showIcon = true }, saveForm () { + for (let i = 0; i < this.questionsFromStore.length; i++) { + const entry = this.questionsFromStore[i] + if (!entry.question.trim() && !entry.answers) { + this.removeQuestion(i) + } + } if (!this.$refs.questyForm.validate()) { return }