From 847ce4a97c64c48f35763ed5e2445441062881d2 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Tue, 20 Sep 2022 17:53:21 +0200 Subject: [PATCH] feat: deleteNamespace script setup --- 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 14afeb389..6028c988f 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 950c1c126..08c041b8e 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'}) - }, + -- 2.40.1