()
| 3 | import * as api from '../api/index.js'; |
| 4 | |
| 5 | export const getPosts = () => async (dispatch) => { |
| 6 | try { |
| 7 | const { data } = await api.fetchPosts(); |
| 8 | |
| 9 | dispatch({ type: FETCH_ALL, payload: data }); |
| 10 | } catch (error) { |
| 11 | console.log(error.message); |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | export const createPost = (post) => async (dispatch) => { |
| 16 | try { |