Created
June 16, 2020 10:02
-
-
Save velotiotech/a05767f7eb8b438e6c021f6db15fa428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getPostById = async (dispatch, id) => { | |
dispatch({ type: GET_POSTS_BY_ID_REQUEST }); | |
try { | |
const response = await getPostsById(id); | |
const res = await response.json(); | |
dispatch({ type: GET_POSTS_BY_ID_SUCCESS, payload: res }); | |
} catch (e) { | |
dispatch({ type: GET_POSTS_BY_ID_FAIL, payload: e }); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment