Created
July 31, 2017 21:34
-
-
Save rgommezz/7ba53b0d635cd249477e878547fe6e69 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
export const fetchUser = (url) => { | |
return function thunk(dispatch) { | |
fetch(url) | |
.then((response) => response.json()) | |
.then((responseJson) => { | |
dispatch({type: FETCH_USER_SUCCESS, payload: responseJson}); | |
}) | |
.catch((error) => { | |
console.error(error); | |
}); | |
}; | |
thunk.interceptInOffline = true; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment