My app requires an initialisation action to be fired, followed by a series of other actions before triggering another action. I found a similar question on Stack Overflow
However, when attempting this approach, only the initial APP_INIT
action is executed, and none of the subsequent actions in the sequence. Can anyone provide assistance?
import { of } from 'rxjs';
import { mergeMap, zip, concat, mapTo } from 'rxjs/operators';
import { ofType } from 'redux-observable';
import { firstAction, secondAction } from 'actions';
export default function appInit (action$) {
return (
action$.pipe(
ofType('APP_INIT'),
mergeMap(() =>
concat(
of(firstAction()),
of(secondAction()),
zip(
action$.ofType('ACTION_ONE_COMPLETE'),
action$.ofType('ACTION_TWO_COMPLETE')
).mapTo(() => console.log('complete'))
)
)
)
);
}