[editor] [#23] Add confirmation for delete buttons

resolves #23

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-04-23 17:35:11 +02:00
parent e1a947494b
commit 05064b08b3
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 38 additions and 8 deletions

View file

@ -352,11 +352,26 @@ export default {
methods: {
deleteAutoMessage(uuid) {
axios.delete(`config-editor/auto-messages/${uuid}`, this.$root.axiosOptions)
this.$bvModal.msgBoxConfirm('Do you really want to delete this message?', {
buttonSize: 'sm',
cancelTitle: 'NO',
centered: true,
okTitle: 'YES',
okVariant: 'danger',
size: 'sm',
title: 'Please Confirm',
})
.then(val => {
if (!val) {
return
}
return axios.delete(`config-editor/auto-messages/${uuid}`, this.$root.axiosOptions)
.then(() => {
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
})
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
})
},
editAutoMessage(msg) {

View file

@ -657,11 +657,26 @@ export default {
},
deleteRule(uuid) {
axios.delete(`config-editor/rules/${uuid}`, this.$root.axiosOptions)
this.$bvModal.msgBoxConfirm('Do you really want to delete this rule?', {
buttonSize: 'sm',
cancelTitle: 'NO',
centered: true,
okTitle: 'YES',
okVariant: 'danger',
size: 'sm',
title: 'Please Confirm',
})
.then(val => {
if (!val) {
return
}
return axios.delete(`config-editor/rules/${uuid}`, this.$root.axiosOptions)
.then(() => {
this.$bus.$emit(constants.NOTIFY_CHANGE_PENDING, true)
})
.catch(err => this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err))
})
},
editRule(msg) {