diff --git a/web/app/common/api.js b/web/app/common/api.js index 93683572..f8afcbbb 100644 --- a/web/app/common/api.js +++ b/web/app/common/api.js @@ -24,7 +24,7 @@ export const getComment = ({ id }) => fetcher.get(`/id/${id}?url=${url}`); export const getUserComments = ({ user, limit }) => fetcher.get(`/comments?user=${user}&limit=${limit}`); -export const vote = ({ id, url, value }) => fetcher.put({ +export const putCommentVote = ({ id, url, value }) => fetcher.put({ url: `/vote/${id}?url=${url}&vote=${value}`, withCredentials: true, }); @@ -112,7 +112,7 @@ export default { getCommentsCount, getComment, getUserComments, - vote, + putCommentVote, send, edit, getUser, diff --git a/web/app/components/comment/comment.jsx b/web/app/components/comment/comment.jsx index 02870a14..72fd8924 100644 --- a/web/app/components/comment/comment.jsx +++ b/web/app/components/comment/comment.jsx @@ -233,7 +233,7 @@ export default class Comment extends Component { this.votingPromise = this.votingPromise .then(() => { - return api.vote({ id, url, value: 1 }) + return api.putCommentVote({ id, url, value: 1 }) .then(() => { api.getComment({ id }).then(comment => store.replaceComment(comment)); }); @@ -254,7 +254,7 @@ export default class Comment extends Component { this.votingPromise = this.votingPromise .then(() => { - return api.vote({ id, url, value: -1 }) + return api.putCommentVote({ id, url, value: -1 }) .then(() => { api.getComment({ id }).then(comment => store.replaceComment(comment)); });