2022-08-04 13:31:14 +02:00
|
|
|
import socket from './socket';
|
|
|
|
import { transformActivity } from './activities';
|
|
|
|
|
|
|
|
/* Actions */
|
|
|
|
|
2022-08-09 18:03:21 +02:00
|
|
|
const createCommentActivity = (cardId, data, headers) =>
|
|
|
|
socket.post(`/cards/${cardId}/comment-actions`, data, headers).then((body) => ({
|
2022-08-04 13:31:14 +02:00
|
|
|
...body,
|
|
|
|
item: transformActivity(body.item),
|
|
|
|
}));
|
|
|
|
|
2022-08-09 18:03:21 +02:00
|
|
|
const updateCommentActivity = (id, data, headers) =>
|
|
|
|
socket.patch(`/comment-actions/${id}`, data, headers).then((body) => ({
|
2022-08-04 13:31:14 +02:00
|
|
|
...body,
|
|
|
|
item: transformActivity(body.item),
|
|
|
|
}));
|
|
|
|
|
2022-08-09 18:03:21 +02:00
|
|
|
const deleteCommentActivity = (id, headers) =>
|
|
|
|
socket.delete(`/comment-actions/${id}`, undefined, headers).then((body) => ({
|
2022-08-04 13:31:14 +02:00
|
|
|
...body,
|
|
|
|
item: transformActivity(body.item),
|
|
|
|
}));
|
|
|
|
|
|
|
|
export default {
|
|
|
|
createCommentActivity,
|
|
|
|
updateCommentActivity,
|
|
|
|
deleteCommentActivity,
|
|
|
|
};
|