2019-08-31 04:07:25 +05:00
|
|
|
import socket from './socket';
|
|
|
|
import { transformAction } from './actions';
|
|
|
|
|
|
|
|
/* Actions */
|
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
const createCommentAction = (cardId, data, headers) =>
|
2020-03-25 00:15:47 +05:00
|
|
|
socket.post(`/cards/${cardId}/comment-actions`, data, headers).then((body) => ({
|
2020-02-03 18:42:31 +05:00
|
|
|
...body,
|
|
|
|
item: transformAction(body.item),
|
|
|
|
}));
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
const updateCommentAction = (id, data, headers) =>
|
2020-03-25 00:15:47 +05:00
|
|
|
socket.patch(`/comment-actions/${id}`, data, headers).then((body) => ({
|
2020-02-03 18:42:31 +05:00
|
|
|
...body,
|
|
|
|
item: transformAction(body.item),
|
|
|
|
}));
|
2019-08-31 04:07:25 +05:00
|
|
|
|
2020-02-03 18:42:31 +05:00
|
|
|
const deleteCommentAction = (id, headers) =>
|
2020-03-25 00:15:47 +05:00
|
|
|
socket.delete(`/comment-actions/${id}`, undefined, headers).then((body) => ({
|
2020-02-03 18:42:31 +05:00
|
|
|
...body,
|
|
|
|
item: transformAction(body.item),
|
|
|
|
}));
|
2019-08-31 04:07:25 +05:00
|
|
|
|
|
|
|
export default {
|
|
|
|
createCommentAction,
|
|
|
|
updateCommentAction,
|
|
|
|
deleteCommentAction,
|
|
|
|
};
|