add endpoint for editing comments

This commit is contained in:
igoradamenko
2018-05-18 19:25:57 +03:00
parent dcbe184f55
commit 7f18f1db16
+10
View File
@@ -10,6 +10,7 @@ export const logOut = () => fetcher.get({ url: `/auth/logout`, overriddenApiBase
export const getConfig = () => fetcher.get(`/config`);
// TODO: looks like we can you url from settings here and below
export const find = ({ sort, url }) => fetcher.get(`/find?url=${url}&sort=${sort}&format=tree`);
export const last = ({ siteId, max }) => fetcher.get(`/last/${max}?site=${siteId}`);
@@ -39,6 +40,14 @@ export const send = ({ text, pid }) => fetcher.post({
withCredentials: true,
});
export const edit = ({ text, id }) => fetcher.put({
url: `/comment/${id}`,
body: {
text,
},
withCredentials: true,
});
export const getPreview = ({ text }) => fetcher.post({
url: '/preview',
body: {
@@ -92,6 +101,7 @@ export default {
getComment,
vote,
send,
edit,
getUser,
getPreview,