Add confirmation check to post deletion function

This commit is contained in:
Carly Ho 2018-12-29 16:55:47 -06:00
parent 1d07c4a72e
commit ebbe842416
1 changed files with 24 additions and 21 deletions

View File

@ -495,18 +495,21 @@ export default {
},
deletePost() {
if($('body').hasClass('loggedIn') == false) {
return;
}
var result = confirm('Are you sure you want to delete this post?');
if (result) {
if($('body').hasClass('loggedIn') == false) {
return;
}
axios.post('/i/delete', {
type: 'status',
item: this.status.id
}).then(res => {
swal('Success', 'You have successfully deleted this post', 'success');
}).catch(err => {
swal('Error', 'Something went wrong. Please try again later.', 'error');
});
axios.post('/i/delete', {
type: 'status',
item: this.status.id
}).then(res => {
swal('Success', 'You have successfully deleted this post', 'success');
}).catch(err => {
swal('Error', 'Something went wrong. Please try again later.', 'error');
});
}
}
}
}