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

Function deletePost

client/src/actions/post.js:73–89  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

71
72// Delete post
73export const deletePost = (id) => async (dispatch) => {
74 try {
75 await api.delete(`/posts/${id}`);
76
77 dispatch({
78 type: DELETE_POST,
79 payload: id
80 });
81
82 dispatch(setAlert('Post Removed', 'success'));
83 } catch (err) {
84 dispatch({
85 type: POST_ERROR,
86 payload: { msg: err.response.statusText, status: err.response.status }
87 });
88 }
89};
90
91// Add post
92export const addPost = (formData) => async (dispatch) => {

Callers

nothing calls this directly

Calls 1

setAlertFunction · 0.90

Tested by

no test coverage detected