summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-17 08:30:36 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-17 08:30:36 +0200
commit8d1112146beff49d19eb025f4fa7c36353aa7872 (patch)
tree791ab2465ae86be4c2d38aa93ff951cbf15abfba
parent16357c0e48bf1006d1fd81f944aa0ac5ddd1e70d (diff)
Avoid duplicate `delete` check
If a delete handler is defined, skip check twice if it is valid
-rw-r--r--components/VTable.vue4
-rw-r--r--pages/admin/index.vue1
-rw-r--r--pages/admin/models.vue3
-rw-r--r--pages/admin/reports.vue3
4 files changed, 4 insertions, 7 deletions
diff --git a/components/VTable.vue b/components/VTable.vue
index 5fb2ad2..225c3f9 100644
--- a/components/VTable.vue
+++ b/components/VTable.vue
@@ -64,7 +64,7 @@
import UserAvatar from "@/components/UserAvatar.vue";
export default {
- props: ["keys", "fields", "path", "deleterow", "delete"],
+ props: ["keys", "fields", "path", "deleterow"],
components: {
"user-avatar": UserAvatar,
},
@@ -76,7 +76,7 @@ export default {
return typeof variable == "boolean";
},
handleDelete(id) {
- this.delete(id);
+ this.deleterow(id);
},
deleteAvatar(id) {
this.$store.dispatch("users/deleteAvatar", id).then((response) => {
diff --git a/pages/admin/index.vue b/pages/admin/index.vue
index 89de614..e08f819 100644
--- a/pages/admin/index.vue
+++ b/pages/admin/index.vue
@@ -8,7 +8,6 @@
v-table(
:keys="['id', 'avatar', 'username', 'email', 'is_staff', 'name']"
:fields="users"
- :deleterow="false"
path="/users/"
)
pagination(:page="page" :pages="pages" v-if="count" path="/admin")
diff --git a/pages/admin/models.vue b/pages/admin/models.vue
index ca84932..148e206 100644
--- a/pages/admin/models.vue
+++ b/pages/admin/models.vue
@@ -42,8 +42,7 @@
:keys="['id', 'name', 'created', 'author', 'likes']"
:fields="models"
path="/models/"
- :deleterow="true"
- :delete="openModal"
+ :deleterow="openModal"
)
pagination(:page="page" :pages="pages" v-if="count" path="/admin/models")
</template>
diff --git a/pages/admin/reports.vue b/pages/admin/reports.vue
index 5866335..65825bb 100644
--- a/pages/admin/reports.vue
+++ b/pages/admin/reports.vue
@@ -50,8 +50,7 @@
v-table(
:keys="['id', 'model_id', 'created', 'updated', 'user', 'resolved', 'note', 'admin_note']"
:fields="warnings"
- :deleterow="true"
- :delete="openModal"
+ :deleterow="openModal"
)
pagination(:page="page" :pages="pages" v-if="count" path="/admin/reports")
</template>