Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fetchProductsEpic = (action$, $store) =>
- action$.ofType(PRODUCTS_DISPLAY)
- .do($store.dispatch({ type: 'ON_PRODUCTS_FETCHNG' }))
- .mergeMap(action => ajax.getJSON(`http://localhost:9000/products`)
- .map(response => productsFetchedAction(response))
- .catch(err => {
- $store.dispatch({ type: 'ON_PRODUCTS_FETCH_ERR', payload: err })
- })
- );
- .do($store.dispatch({ type: 'ON_PRODUCTS_FETCHNG' }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement