Skip to content

Instantly share code, notes, and snippets.

@rgommezz
Created July 31, 2017 21:34
Show Gist options
  • Save rgommezz/7ba53b0d635cd249477e878547fe6e69 to your computer and use it in GitHub Desktop.
Save rgommezz/7ba53b0d635cd249477e878547fe6e69 to your computer and use it in GitHub Desktop.
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