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

import { errorEventAction } from '../slices';
import { initErrorAction, initErrorEventAction } from '@/modules/@common/gql/redux/slices';
import { logOutEventAction } from '@/modules/@common/token/redux/slices';

export default (action$) =>
  action$.pipe(
    ofType(initErrorEventAction.type),
    switchMap(() => concat(of(logOutEventAction()), of(initErrorAction()), of(errorEventAction()))),
  );
