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

import { showNotificationAction as showNotificationSearchResultAction } from '../slices';
import { showNotificationAction } from '@/modules/layout/redux/slices';

export default (action$) =>
  action$.pipe(
    ofType(showNotificationSearchResultAction.type),
    switchMap((action) => {
      const { payload: notification } = action;

      return concat(of(showNotificationAction(notification)));
    }),
  );
