app/containers/Dashboard/saga.js
/*
 * catch all events from channel and create an action
 */
catch all events from channel and create an action
catch all events from channel and create an action
function* handleChannelEvents() {
  console.log('handleChannelEvents forked');
  let secondStop = false;
  while (true) {
    const eventAction = yield take(withdrawChannel);
    console.log(eventAction);
    switch (eventAction.type) {
      case WITHDRAW_SEND_SUCCESS:
        yield put(withdrawSendSuccess(eventAction.tx));
        break;
      case WITHDRAW_MINED_SUCCESS:
        yield put(getDistributionInfo());
        yield put(withdrawMinedSuccess(eventAction.receipt));
        break;
      case WITHDRAW_ERROR:
        yield put(withdrawError(eventAction.error));
        break;
      case COMMIT_ETH_SEND_SUCCESS:
        yield put(commitEthSendSuccess(eventAction.tx));
        break;
      case COMMIT_ETH_MINED_SUCCESS:
        yield put(getDistributionInfo());
        yield put(commitEthMinedSuccess(eventAction.receipt));
        break;
      case COMMIT_ETH_ERROR:
        yield put(commitEthError(eventAction.error));
        break;
      case STOP_CHANNEL_FORK:
        if (secondStop) {
          console.log('going to return');
          return;
        }
        secondStop = true;
        break;
      default:
    }
  }
}
function * handleChannelEvents ( ) { console . log ( 'handleChannelEvents forked' ) ; let secondStop = false ; while ( true ) { const eventAction = yield take ( withdrawChannel ) ; console . log ( eventAction ) ; switch ( eventAction . type ) { case WITHDRAW_SEND_SUCCESS : yield put ( withdrawSendSuccess ( eventAction . tx ) ) ; break ; case WITHDRAW_MINED_SUCCESS : yield put ( getDistributionInfo ( ) ) ; yield put ( withdrawMinedSuccess ( eventAction . receipt ) ) ; break ; case WITHDRAW_ERROR : yield put ( withdrawError ( eventAction . error ) ) ; break ; case COMMIT_ETH_SEND_SUCCESS : yield put ( commitEthSendSuccess ( eventAction . tx ) ) ; break ; case COMMIT_ETH_MINED_SUCCESS : yield put ( getDistributionInfo ( ) ) ; yield put ( commitEthMinedSuccess ( eventAction . receipt ) ) ; break ; case COMMIT_ETH_ERROR : yield put ( commitEthError ( eventAction . error ) ) ; break ; case STOP_CHANNEL_FORK : if ( secondStop ) { console . log ( 'going to return' ) ; return ; } secondStop = true ; break ; default : } } }
catch all events from channel and create an action
catch all events from channel and create an action
// prevent return on first stop // yield put(getAddressInfo()); // yield put(getAddressInfo());