Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. const fetchProductsEpic = (action$, $store) =>
  2. action$.ofType(PRODUCTS_DISPLAY)
  3. .do($store.dispatch({ type: 'ON_PRODUCTS_FETCHNG' }))
  4. .mergeMap(action => ajax.getJSON(`http://localhost:9000/products`)
  5. .map(response => productsFetchedAction(response))
  6. .catch(err => {
  7. $store.dispatch({ type: 'ON_PRODUCTS_FETCH_ERR', payload: err })
  8. })
  9. );
  10.  
  11. .do($store.dispatch({ type: 'ON_PRODUCTS_FETCHNG' }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement