Skip to content

Instantly share code, notes, and snippets.

@smhatre59
Created November 5, 2016 07:28
Show Gist options
  • Save smhatre59/5e5eb145677eb7e756d46999e266a192 to your computer and use it in GitHub Desktop.
Save smhatre59/5e5eb145677eb7e756d46999e266a192 to your computer and use it in GitHub Desktop.
import axios from "axios";
export function fetchUsers(){
return function(dispatch){
axios.get('http://reqres.in/api/users?page=1')
.then((response) =>{
dispatch({type:'FETCH_USERS_FULFILLED', payload:response.data.data});
})
.catch((err) => {
dispatch({type:'FETCH_USERS_REJECTED',payload:err})
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment