1
0
Fork 0

Merge pull request #718 from cmho/702-confirm-deletion

[702] Add confirmation check to post deletion function
This commit is contained in:
daniel 2019-01-05 23:19:00 -07:00 committed by GitHub
commit b7f866441c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

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