| 307 | } |
| 308 | |
| 309 | likeAComment(commentId) { |
| 310 | if (!this.accessToken) { |
| 311 | alert('Login to Like') |
| 312 | return Promise.reject() |
| 313 | } |
| 314 | |
| 315 | const { owner, repo } = this |
| 316 | const comment = this.state.comments.find(comment => comment.id === commentId) |
| 317 | |
| 318 | return http.post(`/repos/${owner}/${repo}/issues/comments/${commentId}/reactions`, { |
| 319 | content: 'heart', |
| 320 | }) |
| 321 | .then(reaction => { |
| 322 | this.state.commentReactions[commentId].push(reaction) |
| 323 | comment.reactions.heart++ |
| 324 | }) |
| 325 | } |
| 326 | |
| 327 | unlikeAComment(commentId) { |
| 328 | if (!this.accessToken) return Promise.reject() |