Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Created March 6, 2019 03:19
Show Gist options
  • Save alexytiger/df1d5a5adaf88d220ad3fc7d7b1d6b4f to your computer and use it in GitHub Desktop.
Save alexytiger/df1d5a5adaf88d220ad3fc7d7b1d6b4f to your computer and use it in GitHub Desktop.
@Effect()
SetAttack$: Observable<Action> = this.actions$.pipe(
ofType(fromAction.ActionTypes.SET_ATTACK),
map((action: fromAction.SetAttack) => action.payload),
exhaustMap((name: string) => this.ethSrv.setAttack(name).pipe(
tap(result => console.log('result', result)),
// retrieve the log information that will contain the event data.
map(result => result.logs[0].args[0]),
map((newName: string) => new fromAction.SetAttackSuccess(newName)),
catchError(err => of(new fromAction.EthError(err)))
)),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment