Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const test = (name) => async dispatch => {
- dispatch({type:types.TEST.PENDING})
- try{
- const data = await fetch('http://localhost:2000/api/users')
- .then(res => res.json())
- return dispatch({type:types.TEST.FULFILLED, payload:data})
- }catch(er){
- dispatch({type:types.TEST.REJECTED})
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement