Fix removing a namespace from state after it was deleted
This commit is contained in:
parent
188134ae2e
commit
9c799ab161
3 changed files with 12 additions and 5 deletions
|
@ -131,9 +131,7 @@ export default {
|
|||
NamespaceSettingsDropdown,
|
||||
},
|
||||
computed: mapState({
|
||||
namespaces(state) {
|
||||
return state.namespaces.namespaces.filter(n => !n.isArchived)
|
||||
},
|
||||
namespaces: state => state.namespaces.namespaces.filter(n => !n.isArchived),
|
||||
currentList: CURRENT_LIST,
|
||||
background: 'background',
|
||||
menuActive: MENU_ACTIVE,
|
||||
|
|
|
@ -135,5 +135,15 @@ export default {
|
|||
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)
|
||||
},
|
||||
},
|
||||
}
|
|
@ -29,9 +29,8 @@ export default {
|
|||
deleteNamespace() {
|
||||
const namespace = this.$store.getters['namespaces/getNamespaceById'](this.$route.params.id)
|
||||
|
||||
this.namespaceService.delete(namespace)
|
||||
this.$store.dispatch('namespaces/deleteNamespace', namespace)
|
||||
.then(() => {
|
||||
this.$store.commit('namespaces/removeNamespaceFromNamespaceById', namespace)
|
||||
this.success({message: 'The namespace was successfully deleted.'}, this)
|
||||
this.$router.push({name: 'home'})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue