(id)
| 71 | |
| 72 | // Delete post |
| 73 | export 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 |
| 92 | export const addPost = (formData) => async (dispatch) => { |
nothing calls this directly
no test coverage detected