(post)
| 13 | }; |
| 14 | |
| 15 | export const createPost = (post) => async (dispatch) => { |
| 16 | try { |
| 17 | const { data } = await api.createPost(post); |
| 18 | |
| 19 | dispatch({ type: CREATE, payload: data }); |
| 20 | } catch (error) { |
| 21 | console.log(error.message); |
| 22 | } |
| 23 | }; |
| 24 | |
| 25 | export const updatePost = (id, post) => async (dispatch) => { |
| 26 | try { |