MCPcopy
hub / github.com/bradtraversy/devconnector_2.0 / deleteComment

Function deleteComment

client/src/actions/post.js:147–163  ·  view source on GitHub ↗
(postId, commentId)

Source from the content-addressed store, hash-verified

145
146// Delete comment
147export const deleteComment = (postId, commentId) => async (dispatch) => {
148 try {
149 await api.delete(`/posts/comment/${postId}/${commentId}`);
150
151 dispatch({
152 type: REMOVE_COMMENT,
153 payload: commentId
154 });
155
156 dispatch(setAlert('Comment Removed', 'success'));
157 } catch (err) {
158 dispatch({
159 type: POST_ERROR,
160 payload: { msg: err.response.statusText, status: err.response.status }
161 });
162 }
163};

Callers

nothing calls this directly

Calls 1

setAlertFunction · 0.90

Tested by

no test coverage detected