Skip to content
Snippets Groups Projects
Commit b12652a8 authored by Marc Hanisch's avatar Marc Hanisch
Browse files

Merge branch '192-fix-configuration-results-after-delete' into 'master'

Remove configuration from search result after deletion

Closes #192

See merge request !180
parents 1a81aada ea4d6cc4
No related branches found
No related tags found
1 merge request!180Remove configuration from search result after deletion
......@@ -135,20 +135,24 @@ export default class SearchConfigurationsPage extends Vue {
this.configurationToDelete = null
}
deleteAndCloseDialog () { // TODO reload current search after deletion
deleteAndCloseDialog () {
this.showDeleteDialog = false
if (this.configurationToDelete === null) {
return
}
this.$api.configurations.deleteById(this.configurationToDelete.id).then(() => {
// remove configuration from search results
const indexToDelete = this.searchResults.findIndex(configuration => configuration.id === this.configurationToDelete?.id)
if (indexToDelete > -1) {
this.searchResults.splice(indexToDelete, 1)
}
this.$store.commit('snackbar/setSuccess', 'Configuration deleted')
}).catch((_error) => {
this.$store.commit('snackbar/setError', 'Configuration could not be deleted')
}).finally(() => {
this.configurationToDelete = null
})
.finally(() => {
this.configurationToDelete = null
})
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment