From 0814890cac92b813b5b93bb42c7a40e2dc13cb94 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 21 Sep 2022 18:21:47 +0000 Subject: [PATCH] feat: deleteNamespace script setup (#2387) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2387 Reviewed-by: konrad Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- src/router/index.ts | 1 + src/views/namespaces/settings/archive.vue | 29 ++++---- src/views/namespaces/settings/delete.vue | 80 ++++++++++++++--------- 3 files changed, 67 insertions(+), 43 deletions(-) diff --git a/src/router/index.ts b/src/router/index.ts index 14afeb38..6028c988 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -249,6 +249,7 @@ const router = createRouter({ meta: { showAsModal: true, }, + props: route => ({ namespaceId: Number(route.params.id as string) }), }, { path: '/tasks/:id', diff --git a/src/views/namespaces/settings/archive.vue b/src/views/namespaces/settings/archive.vue index 950c1c12..08c041b8 100644 --- a/src/views/namespaces/settings/archive.vue +++ b/src/views/namespaces/settings/archive.vue @@ -22,7 +22,7 @@ export default { name: 'namespace-setting-archive' } -export default defineComponent({ - name: 'namespace-setting-delete', - computed: { - namespace() { - return this.$store.getters['namespaces/getNamespaceById'](this.$route.params.id) - }, - title() { - if (!this.namespace) { - return - } - return this.$t('namespace.delete.title', {namespace: this.namespace.title}) - }, - }, - watch: { - title: { - handler(title) { - setTitle(title) - }, - immediate: true, - }, - }, - methods: { - async deleteNamespace() { - await this.$store.dispatch('namespaces/deleteNamespace', this.namespace) - this.$message.success({message: this.$t('namespace.delete.success')}) - this.$router.push({name: 'home'}) - }, +