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,
|
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,
|
||||||
|
|
|
@ -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)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
|
@ -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'})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue