How to use the redux-form/immutable.change function in redux-form

To help you get started, we’ve selected a few redux-form 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 bosch-io / iot-hub-devui / developer-ui-frontend / src / components / Registrations / Modals / AddRegistrationModal / AddRegistrationModalContainer.js View on Github external
changeCurrentlySelectedDevice: deviceId =>
    dispatch(change("registrationsTabListing", "selectedDevice", deviceId))
});
github OasisDEX / oasis-react / src / store / reducers / wrapUnwrap.js View on Github external
const setWrapMax = () => (dispatch, getState) => {
  const activeUnwrappedToken = wrapUnwrap.activeUnwrappedToken(getState());
  const maxWrapValueInEther =
    activeUnwrappedToken === TOKEN_ETHER
      ? web3.fromWei(balances.ethBalance(getState()))
      : balances.tokenBalance(getState(), { tokenName: activeUnwrappedToken });
  if (maxWrapValueInEther) {
    dispatch(
      change(
        activeUnwrappedToken === TOKEN_ETHER ? "wrapEther" : "wrapTokenWrapper",
        "amount",
        maxWrapValueInEther.toString()
      )
    );
  }
};
github OasisDEX / oasis-react / src / store / reducers / offerTakes.js View on Github external
) => (dispatch, getState) => {
  const { price } = formValueSelector("takeOffer")(
    getState(),
    "volume",
    "total",
    "price"
  );

  if (isNaN(value)) {
    dispatch(form.change("takeOffer", "total", "0"));
  } else {
    dispatch(
      form.change(
        "takeOffer",
        "total",
        web3
          .toBigNumber(value)
          .mul(price)
          .toFixed()
          .toString()
      )
    );
  }

  dispatch(defer(getTransactionGasCostEstimateEpic));
};
github OasisDEX / oasis-react / src / store / reducers / wrapUnwrap.js View on Github external
const setUnwrapMax = () => (dispatch, getState) => {
  const activeWrappedToken = wrapUnwrap.activeWrappedToken(getState());
  const maxUnwrapValueInEther = balances.tokenBalance(getState(), {
    tokenName: activeWrappedToken
  });

  if (maxUnwrapValueInEther) {
    dispatch(
      change(
        activeWrappedToken === TOKEN_WRAPPED_ETH
          ? "unwrapEther"
          : "unwrapTokenWrapper",
        "amount",
        maxUnwrapValueInEther.toString()
      )
    );
  }
};
github OasisDEX / oasis-react / src / store / reducers / offerTakes.js View on Github external
) => (dispatch, getState) => {
  const { price } = formValueSelector("takeOffer")(
    getState(),
    "volume",
    "total",
    "price"
  );

  if (isNaN(value)) {
    dispatch(form.change("takeOffer", "total", "0"));
  } else {
    dispatch(
      form.change(
        "takeOffer",
        "total",
        web3
          .toBigNumber(value)
          .mul(price)
          .toFixed()
          .toString()
      )
    );
  }

  dispatch(defer(getTransactionGasCostEstimateEpic));
};
github OasisDEX / oasis-react / src / store / reducers / offerTakes.js View on Github external
) => (dispatch, getState) => {
  const usersQuoteTokenBalanceBN = web3.toBigNumber(
    quoteTokenBalance(getState())
  );

  const activeOfferTakeData = offerTakeOfferData(getState());
  const volume = activeOfferTakeData.get("buyHowMuch");
  const priceBN = web3.toBigNumber(activeOfferTakeData.get("ask_price"));

  const total = usersQuoteTokenBalanceBN.gte(priceBN.mul(volume))
    ? web3.fromWei(priceBN.mul(volume), ETH_UNIT_ETHER)
    : web3.fromWei(usersQuoteTokenBalanceBN, ETH_UNIT_ETHER);

  const totalSerialized = total.toString();

  dispatch(form.change("takeOffer", "total", totalSerialized));
  dispatch(defer(totalFieldValueChangedEpic, totalSerialized));
};
github OasisDEX / oasis-react / src / store / reducers / offerTakes.js View on Github external
);

  dispatch(
    form.change(
      "takeOffer",
      "volume",
      web3
        .toBigNumber(value)
        .div(price)
        .toFixed()
        .toString()
    )
  );

  if (isNaN(value)) {
    dispatch(form.change("takeOffer", "volume", "0"));
  } else {
    dispatch(
      form.change(
        "takeOffer",
        "volume",
        web3
          .toBigNumber(value)
          .div(price)
          .toFixed()
          .toString()
      )
    );
  }

  dispatch(defer(getTransactionGasCostEstimateEpic));
};
github OasisDEX / oasis-react / src / store / reducers / transfers.js View on Github external
const setTransferMax = () => (dispatch, getState) => {
  const maxTransferValueInEther = balances.tokenBalance(getState(), {
    tokenName: transfers.selectedToken(getState())
  });
  if (maxTransferValueInEther) {
    dispatch(
      change("tokenTransfer", "tokenAmount", maxTransferValueInEther.toString())
    );
  }
};
github OasisDEX / oasis-react / src / store / reducers / offerMakes.js View on Github external
) => (dispatch, getState) => {
  const balance = activeBaseTokenBalance(getState());
  const formName = offerMakeToFormName(offerMakeType);

  const { price } = currentFormValues(getState())(formName);

  const usersBaseTokenBalanceBN = web3.toBigNumber(web3.fromWei(balance));
  const priceBN = web3.toBigNumber(price.toString());

  const totalSerialized = usersBaseTokenBalanceBN
    .mul(priceBN)
    .toFixed()
    .toString();
  dispatch(change(formName, "total", totalSerialized));
  dispatch(defer(totalFieldValueChangedEpic, offerMakeType, totalSerialized));
};