Fix removing a namespace from state after it was deleted
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2021-05-26 17:39:57 +02:00
parent 188134ae2e
commit 9c799ab161
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 12 additions and 5 deletions

View File

@ -131,9 +131,7 @@ export default {
NamespaceSettingsDropdown, NamespaceSettingsDropdown,
}, },
computed: mapState({ computed: mapState({
namespaces(state) { namespaces: state => state.namespaces.namespaces.filter(n => !n.isArchived),
return state.namespaces.namespaces.filter(n => !n.isArchived)
},
currentList: CURRENT_LIST, currentList: CURRENT_LIST,
background: 'background', background: 'background',
menuActive: MENU_ACTIVE, menuActive: MENU_ACTIVE,

View File

@ -135,5 +135,15 @@ export default {
return Promise.resolve() return Promise.resolve()
} }
}, },
deleteNamespace(ctx, namespace) {
const namespaceService = new NamespaceService()
return namespaceService.delete(namespace)
.then(r => {
ctx.commit('removeNamespaceById', namespace.id)
return Promise.resolve(r)
})
.catch(Promise.reject)
},
}, },
} }

View File

@ -29,9 +29,8 @@ export default {
deleteNamespace() { deleteNamespace() {
const namespace = this.$store.getters['namespaces/getNamespaceById'](this.$route.params.id) const namespace = this.$store.getters['namespaces/getNamespaceById'](this.$route.params.id)
this.namespaceService.delete(namespace) this.$store.dispatch('namespaces/deleteNamespace', namespace)
.then(() => { .then(() => {
this.$store.commit('namespaces/removeNamespaceFromNamespaceById', namespace)
this.success({message: 'The namespace was successfully deleted.'}, this) this.success({message: 'The namespace was successfully deleted.'}, this)
this.$router.push({name: 'home'}) this.$router.push({name: 'home'})
}) })