Within my application, a comment has the ability to serve as a parent and have various child comments associated with it. When I initiate the deletion of a parent comment, I verify the existence of any child comments. If children are present, I proceed to delete them individually using separate Axios
calls.
After this process is complete, I am in need of executing some code to refresh the page. How can I accomplish this task in a straightforward manner? Where should I position my code for refreshing the content?
Below is the current status of my code implementation:
deleteCommentAxiosCall (id) {
return this.$axios.delete(`/api/v1/comment/${this.comment.id}`)
},
deleteComment () {
return new Promise((resolve, reject) => {
this.deleteCommentAxiosCall(this.comment.id)
if (this.comment.child_comments.length) {
this.comment.child_comments.forEach((child) => {
this.deleteCommentAxiosCall(child.id)
})
}
})
window.location.reload() // code for refreshing the page