How to use the @redux-saga/core/effects.getContext function in @redux-saga/core

To help you get started, we’ve selected a few @redux-saga/core 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 uprtcl / js-uprtcl / packages / common / src / access-control / state / access-control.sagas.ts View on Github external
function* filterUpdatableEntity(action: LoadEntitySuccess) {
  const recognizer: PatternRecognizer = (yield getContext(ReduxTypes.Context)).get(
    PatternTypes.Recognizer
  );

  const updatable: Updatable | undefined = recognizer.recognizeUniqueProperty(
    action.payload.entity,
    prop => !!(prop as Updatable).update
  );

  if (updatable) {
    const accessControlAction: LoadAccessControl = {
      type: LOAD_ACCESS_CONTROL,
      payload: action.payload
    };
    yield put(accessControlAction);
  }
}
github uprtcl / js-uprtcl / modules / evees / src / state / evees.sagas.ts View on Github external
function* loadPerspectiveDetails(action: LoadPerspectiveDetails) {
  const evees: Evees = (yield getContext(ReduxTypes.Context)).get(EveesTypes.Evees);
  const details = yield call(() => evees.getPerspectiveDetails(action.payload.perspectiveId));

  const successAction: LoadPerspectiveDetailsSuccess = {
    type: LOAD_PERSPECTIVE_DETAILS_SUCCESS,
    payload: {
      perspectiveId: action.payload.perspectiveId,
      details
    }
  };
  yield put(successAction);
}
github uprtcl / js-uprtcl / modules / evees / src / state / evees.sagas.ts View on Github external
function* filterPerspectiveEntity(action: LoadEntitySuccess) {
  const perspectivePattern: PerspectiveEntity = (yield getContext(ReduxTypes.Context)).get(
    EveesTypes.PerspectivePattern
  );

  if (perspectivePattern.recognize(action.payload.entity)) {
    const loadPerspectiveDetailsAction: LoadPerspectiveDetails = {
      type: LOAD_PERSPECTIVE_DETAILS,
      payload: { perspectiveId: action.payload.hash }
    };
    yield put(loadPerspectiveDetailsAction);
  }
}
github uprtcl / js-uprtcl / packages / common / src / access-control / state / access-control.sagas.ts View on Github external
function* loadAccessControl(action: LoadAccessControl) {
  const recognizer: PatternRecognizer = (yield getContext(ReduxTypes.Context)).get(
    PatternTypes.Recognizer
  );

  const updatable: Updatable | undefined = recognizer.recognizeUniqueProperty(
    action.payload.entity,
    prop => !!(prop as Updatable).update
  );

  if (updatable) {
    const accessControlService: AccessControlService | undefined = updatable.accessControl(
      action.payload.entity
    );

    if (accessControlService) {
      const accessControlInformation: any | undefined = yield retry(4, 3000, () =>
        accessControlService.getAccessControlInformation(action.payload.hash)