Skip to content

Instantly share code, notes, and snippets.

@panvourtsis
Last active June 12, 2019 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panvourtsis/1cb5bc76bd7f4d95046f66fbc7b22334 to your computer and use it in GitHub Desktop.
Save panvourtsis/1cb5bc76bd7f4d95046f66fbc7b22334 to your computer and use it in GitHub Desktop.
const fetchUserEpic = (action$: ActionsObservable<UserActionTypes>) =>
action$.pipe(
ofType(FETCH_USER_REQUEST),
switchMap(() =>
from(API.fetch()).pipe(
mergeMap(data => of(setUserInfo(data))),
catchError(() => of(unsetUserInfo()))
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment