Skip to content

Instantly share code, notes, and snippets.

@anteburazer
Created May 12, 2017 08:03
Show Gist options
  • Save anteburazer/d896f7cd79a0c20948a20c3915cfe544 to your computer and use it in GitHub Desktop.
Save anteburazer/d896f7cd79a0c20948a20c3915cfe544 to your computer and use it in GitHub Desktop.
@Effect()
doLogin$: Observable<Action> = this.actions$
.ofType(actions.ActionTypes.DO_LOGIN)
.map((action: actions.DoLoginAction) => action.payload)
.switchMap(state => {
return this.authApiClient.login(state)
.map(user => new actions.DoLoginSuccessAction(new User(user)))
.catch(error => of(new actions.DoLoginFailAction()));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment