How to use the redux-observable.combineEpics function in redux-observable

To help you get started, we’ve selected a few redux-observable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HiJesse / Demeter / react / epics / Epics.js View on Github external
// epics
import {combineEpics} from "redux-observable";
import {userManagerEpics} from "./UserManagerEpic";
import {userEpics} from "./UserEpic";
import {projectManagerEpics} from "./ProjectManagerEpic";
import {projectMembersManagerEpics} from "./ProjectMembersManagerEpic";
import {dashboardEpics} from "./DashboardEpic";
import {ArchiveManagerEpics} from "./ArchiveManagerEpic";


export const epics = combineEpics(
    userEpics,
    userManagerEpics,
    projectManagerEpics,
    projectMembersManagerEpics,
    dashboardEpics,
    ArchiveManagerEpics
);
github simonccarter / react-conf-videos / src / redux / modules / search.ts View on Github external
}
      }

      // if no/empty query, return original/all set of videos
      rAction.payload = isFilterEmpty(filterValue) ?
        filteredConferences :
        computeFilteredConferences({
          filterValue: cleanQuery(filterValue),
          conferences: filteredConferences,
          presenters: presentersSearchable,
          videos: videosSearchable
        })
      return rAction
    })

export const searchEpics = combineEpics(filterEpic)
export const searchActions = {
  filter,
  setIsActive
}

// conferences is a local copy, than can be used to reset filteredConferences when there is no search query
// filteredConferences contains a filtered list of conferences, with videos filtered by search match
// if a conference contains no videos that match, it is removed from the filter
export const initialState = Immutable({
  conferences: {},
  filterValue: '',
  isActive: false
})

const searchReducer = (state = initialState, action: Action) => {
  switch (action.type) {
github lanux / react-admin / src / redux / epics / index.js View on Github external
//   throw new Error(res.error)
          // } else if (res.results) {
          //   return res.results
          // } else {
          //   throw new Error('invalid response')
          // }
        })
        // 当结果处理完成后,就可以将其作为参数交给下一个action:fetchReceive进行dispatch。
        .map(actions.fetchReceive)
        // 如果有错误的话,就交给相应的action来处理。在这里,这个action必须使用Observable.of方法转为一个observable
        // .catch(error => Observable.of(actions.createError(error)))
    })
}

// combineEpics会将参数中的epic函数合并到一起
export default combineEpics(fetch)
github oysterprotocol / webnode / directories / src / redux / epics / peer-epics.js View on Github external
const requestPeerSendEpics = action$ =>
  action$
    .ofType(PEER_SEND_REQUEST)
    .map(action => {
      const receiver = action.payload.receiver;
      const connection = action.peer.connect(receiver);
      connection.on("open", () => {
        console.log("send", action.payload);
        connection.send(action.payload);
      });
      return action.payload;
    })
    .flatMap(payload => [fulfillPeerSend(payload)]);

export default combineEpics(requestPeerReceiveEpics, requestPeerSendEpics);
github all-of-us / workbench / ui / src / app / cohort-search / redux / index.ts View on Github external
constructor(
    ngRedux: NgRedux,
    epics: CohortSearchEpics,
    devTools: DevToolsExtension,
  ) {

    let storeEnhancers = [];
    if (devTools.isEnabled()) {
      storeEnhancers = [...storeEnhancers, devTools.enhancer()];
    }

    const middleware = [
      createEpicMiddleware(
        combineEpics(
          epics.fetchCriteria,
          epics.fetchCriteriaBySubtype,
          epics.fetchAllCriteria,
          epics.fetchDrugCriteria,
          epics.fetchAutocompleteOptions,
          epics.fetchIngredientsForBrand,
          epics.fetchAttributes,
          epics.fetchCount,
          epics.fetchChartData,
          epics.previewCount,
          epics.attributePreviewCount,
        )
      )
    ];

    ngRedux.configureStore(
github Opentrons / opentrons / app / src / shell / buildroot / update-epics.js View on Github external
allRobots.some(r => r.name === robotName)
      )
    }),
    switchMap(stateWithRobotName => {
      const robotName: string = (getBuildrootRobotName(stateWithRobotName): any)
      return of(removeRobot(robotName))
    })
  )

export const disconnectRpcOnStartEpic: Epic = action$ =>
  action$.pipe(
    ofType(BR_START_UPDATE),
    switchMap<_, _, mixed>(() => of(robotActions.disconnect()))
  )

export const buildrootUpdateEpic = combineEpics(
  startUpdateEpic,
  cancelSessionOnConflictEpic,
  triggerUpdateAfterPremigrationEpic,
  triggerUpdateAfterCancelEpic,
  triggerUpdateAfterUserFileInfo,
  statusPollEpic,
  uploadFileEpic,
  commitUpdateEpic,
  restartAfterCommitEpic,
  watchForOfflineAfterRestartEpic,
  watchForOnlineAfterRestartEpic,
  removeMigratedRobotsEpic,
  disconnectRpcOnStartEpic
)
github nteract / nteract / applications / notebook-on-next / store.js View on Github external
export default function configureStore() {
  const rootEpic = combineEpics(...epics);
  const middlewares = [createEpicMiddleware(rootEpic)];

  return createStore(
    rootReducer,
    defaultState,
    composeEnhancers(applyMiddleware(...middlewares))
  );
}
github HiJesse / Demeter / react / epics / ProjectMembersManagerEpic.js View on Github external
* 退出项目 epic
 * @param action$
 */
export const quitProjectMemberEpic = action$ =>
    action$.ofType(ACTION_QUIT_PROJECT)
        .mergeMap(action => ajaxRequest({
            actionType: ACTION_QUIT_PROJECT_FULFILLED,
            method: AJAX_METHOD.POST,
            url: URL_QUIT_PROJECT,
            params: action.data
        }));

/**
 * 项目所属成员管理相关 epic方法汇总
 */
export const projectMembersManagerEpics = combineEpics(
    addMemberEpic,
    fetchProjectMemberListEpic,
    deleteProjectMemberEpic,
    quitProjectMemberEpic
);