From b51ab513cb373786be625d0a29fd477a494c8a4b Mon Sep 17 00:00:00 2001 From: Alexandros SIDIRAS Date: Wed, 5 Jun 2024 15:10:00 +0200 Subject: [PATCH] Simplified delete --- components/pictos/deleteItem.vue | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/components/pictos/deleteItem.vue b/components/pictos/deleteItem.vue index c441dfda..b7b8d413 100644 --- a/components/pictos/deleteItem.vue +++ b/components/pictos/deleteItem.vue @@ -11,12 +11,12 @@

- {{ $t("PleaseType1") }} {{ object.meaning[getUserLang] + {{ $t("PleaseType1") }} {{ name }} {{ $t("PleaseType2") }} - + @@ -39,20 +39,30 @@ export default { required: true, }, }, + computed: { + lowerCaseInput: { + get() { + return this.input; + }, + set(value) { + this.input = value.trim().toLowerCase().replace(/\s/g, "-"); + } + } + }, data() { return { - meaningOrName: "", + input: "", loading: false, + name: "" }; }, + created() { + this.name = this.object.meaning[this.getUserLang].trim().toLowerCase().replace(/\s/g, "-"); + }, methods: { - async onSubmitted(name) { + async onSubmitted(input) { this.loading = true; - // We need to format name to compare it with the object name - // Remove trailing and leading spaces - name = name.trim(); - // Remove leading < and trailing > characters - if (name == this.object.meaning[this.getUserLang].trim()) { + if (input == this.name) { try { if (this.object.collection) { const res = await this.$store.dispatch("removeCollection", {