From b027dd48c7ab0ca1e898b6b61f1c6448a9d1eab4 Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Fri, 2 Feb 2018 23:47:41 +0200 Subject: [PATCH] add getComment support to api --- web/app/common/api.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/app/common/api.js b/web/app/common/api.js index 859c9155..b845cb1a 100644 --- a/web/app/common/api.js +++ b/web/app/common/api.js @@ -4,14 +4,24 @@ import fetcher from './fetcher' export const find = ({ url }) => fetcher.get(`/find?url=${url}&sort=time&format=tree`); +export const getComment = ({ id }) => fetcher.get(`/id/${id}?url=${url}`); + export const getUser = () => fetcher.get('/user'); -export const send = ({ text }) => fetcher.post('/comment', { text, locator: { site: siteId, url } }); +export const send = ({ text, pid }) => fetcher.post('/comment', { + text, + locator: { + site: siteId, + url + }, + ...(pid ? { pid } : {}), +}); export const vote = ({ id, url, value }) => fetcher.put(`/vote/${id}?url=${url}&vote=${value}`); export default { find, + getComment, send, vote, getUser,