Created
January 5, 2019 23:19
-
-
Save aigoncharov/e64dab647210b8365320aec98dfef040 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 catsGetAsync = async (dispatch) => { | |
dispatch(new CatsGetInit()) | |
try { | |
const res = await fetch('https://cats.com/api/v1/cats') | |
const body = await res.json() | |
dispatch(new CatsGetSuccess(body)) | |
} catch (error) { | |
dispatch(new CatsGetError(error)) | |
dispatch(new GlobalErrorInit(error)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment