Created
November 5, 2016 07:28
-
-
Save smhatre59/5e5eb145677eb7e756d46999e266a192 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
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