Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
{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 => {
const selectedDropdownItem = selector(state, "selectedDropdownItem");
return { selectedDropdownItem };
},
dispatch => {
return {
newFilter: filter => dispatch(newFilter(filter))
};
}
)(FilterForm);
FilterForm.propTypes = {
newFilter: PropTypes.func,
/**
* The currently selected filter category in the dropdown menu.
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) {
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);
const makeFormValuesSelector = formName => {
return formValueSelector(formName);
};
type="submit"
>
{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 => 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'),
const getWrapAmount = (rootState, wrapType) =>
web3.toWei(
formValueSelector(
wrapType === WRAP_ETHER ? "wrapEther" : "wrapTokenWrapper"
)(rootState, "amount"),
ETH_UNIT_ETHER
);
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
}
};
};
const mapStateToProps = state => ({
fetchingRegistrations: selectFetchingDevices(state),
tenant: selectTenant(state),
selectedDevice: formValueSelector("registrationsTabListing")(
state,
"selectedDevice"
)
});
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"),
};
};