Confirm before account delete

This commit is contained in:
Bubka 2020-01-06 22:03:40 +01:00
parent 9e7ea7d0fb
commit 3350da4927

View File

@ -89,14 +89,16 @@
},
deleteAccount: function (id) {
let token = localStorage.getItem('jwt')
if(confirm("Are you sure you want to delete this account?")) {
let token = localStorage.getItem('jwt')
axios.defaults.headers.common['Content-Type'] = 'application/json'
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
axios.defaults.headers.common['Content-Type'] = 'application/json'
axios.defaults.headers.common['Authorization'] = 'Bearer ' + token
axios.delete('/api/twofaccounts/' + id).then(response => {
this.accounts.splice(this.accounts.findIndex(x => x.id === id), 1);
})
axios.delete('/api/twofaccounts/' + id).then(response => {
this.accounts.splice(this.accounts.findIndex(x => x.id === id), 1);
})
}
}
},
beforeRouteEnter (to, from, next) {