How to use the redux-form/immutable.formValueSelector 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 jackdh / RasaTalk / app / containers / LoginPage / saga.js View on Github external
LOGIN_REQUEST,
  LOGOUT,
  SET_AUTH,
  SET_LOADING,
  REGISTER_REQUEST,
} from './constants';
import Auth from './Auth';
import {
  loginRequestFailure,
  loading,
  registerRequestFailure,
} from './actions';

const debug = _debug('LoginPage/saga.js');
const selector = formValueSelector('loginPage');
const registerSelector = formValueSelector('registerPage');

export function* authorise() {
  debug('Authorise: going to set sending to true');
  yield put(loading(true));
  try {
    const { email, password } = yield select(state =>
      selector(state, 'email', 'password'),
    ); // <-- get the project
    debug('Authorise: Got username %s and password %s', email, password);
    const {
      data: { token, user },
    } = yield call(axios.post, '/auth/login', { email, password });
    return { success: true, token, user };
  } catch ({ request: { response } }) {
    debug('Authorise: We got an error %O', response);
    const error = JSON.parse(response).message;
github bosch-io / iot-hub-devui / developer-ui-frontend / src / components / MessagingLiveFeed / FilteredLoggingsView / FilterableLogTable / container / FilterForm.js View on Github external
{FILTER_CATEGORIES.map((category, index) => (
            <option value="{category}">
              {category}
            </option>
          ))}
        
      
    );
  }
}

// Decorate with reduxForm HOC for redux action dispatching props like handleSubmit (handled by the formReducer)
FilterForm = reduxForm({ form: "filterSearchbar" })(FilterForm);
/* Get the selectedDropdownItem from redux store state and map it to a prop (to access it from anywhere not just its
Field implementation). Add the newFilters dispatch method to the props. */
const selector = formValueSelector("filterSearchbar");
FilterForm = connect(
  state =&gt; {
    const selectedDropdownItem = selector(state, "selectedDropdownItem");
    return { selectedDropdownItem };
  },
  dispatch =&gt; {
    return {
      newFilter: filter =&gt; dispatch(newFilter(filter))
    };
  }
)(FilterForm);

FilterForm.propTypes = {
  newFilter: PropTypes.func,
  /**
   * The currently selected filter category in the dropdown menu.
github machawk1 / wail / wail-ui / components / collections / addToCollection / fromLiveWeb / checkSeed.js View on Github external
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import RaisedButton from 'material-ui/FlatButton'
import { formValueSelector } from 'redux-form/immutable'
import { connect } from 'react-redux'
import isURL from 'validator/lib/isURL'
import partialRight from 'lodash/partialRight'
import { checkUrl } from '../../../../actions/archival'
import CheckResults from './checkResults'

const urlSelector = partialRight(formValueSelector('archiveUrl'), 'url')

const dispatchToProp = dispatch => ({
  doCheck (url) {
    dispatch(checkUrl(url))
  }
})

class CheckSeed extends Component {
  static propTypes = {
    col: PropTypes.string.isRequired
  }
  static contextTypes = {
    store: PropTypes.object.isRequired
  }

  constructor (...args) {
github OasisDEX / oasis-react / src / store / selectors / offerTakes.js View on Github external
s.get("offerData")
);

const activeOfferTakeOfferOwner = createSelector(activeOfferTake, s =>
  s.getIn(["offerData", "owner"])
);

const activeOfferTakeBuyToken = createSelector(activeOfferTake, s =>
  s.get("buyToken")
);

const activeOfferTakeSellToken = createSelector(activeOfferTake, s =>
  s.get("sellToken")
);

const takeFormValuesSelector = formValueSelector("takeOffer");

const isOfferBelowLimit = createSelector(offerTakesState, s =>
  s.get("isOfferBelowLimit")
);

const hasSufficientTokenAmount = createSelector(
  balances.tokenBalances,
  activeOfferTakeSellToken,
  activeOfferTakeType,
  rootState => takeFormValuesSelector(rootState, "volume", "total", "price"),
  (tokenBalances, sellToken, activeOfferTakeType, { total, volume }) => {
    if (!total) {
      return true;
    } else {
      const totalInWei = web3.toWei(total, ETH_UNIT_ETHER);
      const volumeInWei = web3.toWei(volume, ETH_UNIT_ETHER);
github OasisDEX / oasis-react / src / store / selectors / offerMakes.js View on Github external
const makeFormValuesSelector = formName => {
  return formValueSelector(formName);
};
github web-pal / DBGlass / app / components / Connect / Content / ReduxFormMain.js View on Github external
type="submit"
              &gt;
                {submitting ? 'Connecting' : 'Connect'}
              
            
          
        
      
    );
  }
}

ReduxFormMain.propTypes = propTypes;


const selector = formValueSelector('connect');
const ReduxFormMainDecorated = reduxForm({
  form: 'connect',
  validate,
  enableReinitialize: true
})(ReduxFormMain);

function mapStateToProps(state) {
  const initData = state.favorites.favorites.find(
      x =&gt; x.get('id') === state.favorites.selectedFavorite
    ) || fromJS({ port: 5432, address: 'localhost', sshPort: 22, sshAuthType: 'password', useSSL: true });
  return {
    favorites: state.favorites.favorites,
    selectedFavorite: state.favorites.get('selectedFavorite'),
    useSSH: selector(state, 'useSSH'),
    sshKey: selector(state, 'privateKey'),
    sshAuthType: selector(state, 'sshAuthType'),
github OasisDEX / oasis-react / src / store / reducers / wrapUnwrap.js View on Github external
const getWrapAmount = (rootState, wrapType) =>
  web3.toWei(
    formValueSelector(
      wrapType === WRAP_ETHER ? "wrapEther" : "wrapTokenWrapper"
    )(rootState, "amount"),
    ETH_UNIT_ETHER
  );
github bosch-io / iot-hub-devui / developer-ui-frontend / src / components / Registrations / Modals / AddGatewayModal / index.js View on Github external
const mapStateToProps = (state, ownProps) => {
  const selector = formValueSelector("gatewayTab");
  const gateways = selectAllDevices(state);
  return {
    gatewaySearch: selector(state, "gatewaySearchText"),
    selectedGateway: selector && selector(state, "via"),
    viaProperty: selectRegistrationInfo(state, ownProps.deviceId).get("via"),
    gatewayDevices: gateways.map(device => device.get("deviceId")),
    deviceData: gateways.map(device => ({
      deviceId: device.get("deviceId"),
      selected: false
    })),
    initialValues: {
      selectedDevice: ownProps.match.params.selectedDeviceId || null
    }
  };
};
github bosch-io / iot-hub-devui / developer-ui-frontend / src / components / Registrations / Modals / AddRegistrationModal / AddRegistrationModalContainer.js View on Github external
const mapStateToProps = state => ({
  fetchingRegistrations: selectFetchingDevices(state),
  tenant: selectTenant(state),
  selectedDevice: formValueSelector("registrationsTabListing")(
    state,
    "selectedDevice"
  )
});
github kalmhq / kalm / frontend / src / forms / RoleBinding / index.tsx View on Github external
const mapStateToProps = (state: RootState, { form }: OwnProps) => {
  const selector = formValueSelector(form || ROLE_BINDING_FORM_ID);
  return {
    namespaces: state
      .get("applications")
      .get("applications")
      .map((application) => application.get("name")),
    kind: selector(state, "kind"),
    name: selector(state, "name"),
  };
};