Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. export const test = (name) => async dispatch => {
  2. dispatch({type:types.TEST.PENDING})
  3. try{
  4. const data = await fetch('http://localhost:2000/api/users')
  5. .then(res => res.json())
  6. return dispatch({type:types.TEST.FULFILLED, payload:data})
  7. }catch(er){
  8. dispatch({type:types.TEST.REJECTED})
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement