I'm using redux-observable to act as the middleware between dispatching actions and the store. I'm trying to use the rxjs sample
function to accomplish this, but unfortunately it's not working for me. Here's my epic:
export const inviteUserEpic = (action$) => {
return action$.ofType(a.INVITE_USER)
.flatMap(({ body }) => {
return Observable.concat(
Observable.of({ type: authActions.REGISTER_REQ, body }),
Observable.of(push(`/team/${body.teamId}`))
.sample(action$.ofType(authActions.REGISTER_SUCCESS))
);
});
};
Basically the idea is that there are multiple places to register a new user, and in this case I want to redirect to the team page after I successfully register the user. I'm seeing REGISTER_REQ emit, and it will subsequently emit REGISTER_SUCCESS. But the redirect observable is never sampled.