import { ofType } from 'redux-observable';
import { concat, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';

import { getAdvertiserSettingsTabAction, initializeAdvertiserFormDataAction } from '../slices';

export default (action$) =>
  action$.pipe(
    ofType(initializeAdvertiserFormDataAction.type),
    switchMap(() => {
      const actions = [of(getAdvertiserSettingsTabAction())];
      return concat(...actions);
    }),
  );
