Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const submit = (config, values) => (dispatch, getState) => {
const { form, validate, onSubmit, asyncValidate } = config
let { fields } = config
const formState = getState().form[form]
values = values || getFormValues(form)(getState()) || {}
if (!formState) {
dispatch(initialize(form, values))
fields.forEach((field) => {
dispatch(registerField(form, field, 'Field'))
})
values = getFormValues(form)(getState())
} else if (formState.registeredFields) {
fields = formState.registeredFields.map((field) => field.name)
} else {
throw new Error('You must set fields on redux-form config')
}
if (typeof validate === 'function') {
dispatch(updateSyncErrors(form, validate(values)))
}
const props = {
...config,
dispatch,
startSubmit: () => dispatch(startSubmit(form)),
stopSubmit: (...args) => dispatch(stopSubmit(form, ...args)),
setSubmitFailed: (...args) => dispatch(setSubmitFailed(form, ...args)),
const mapStateToFormGeneratorProps = (state, { form: formName }) => ({
form: formName,
data: getFormValues(formName)(state)
});
const mapStateToProps = state => ({
customerListFilter: getFormValues('customerListFilter')(state),
});
export function* validate(options) {
const isTouched = true;
const state = yield select();
const validationConfig = yield select(
makeWidgetValidationSelector(options.validatedWidgetId)
);
const values = (yield select(getFormValues(options.validatedWidgetId))) || {};
const notValid =
options.validate &&
(yield call(
validateField(
validationConfig,
options.validatedWidgetId,
state,
isTouched
),
values,
options.dispatch
));
return notValid;
}
function* copyAndUpdateRequests>(
requestUuid: string, requestWithOutput: any, config: ManagementEffectsConfig) {
const virtualEnvsAndRequestsFormData: VirtualEnvAndRequestsContainer = yield select(getFormValues(config.formName));
const updatedRequestsCopy = virtualEnvsAndRequestsFormData.requests.slice();
const requestIndex = updatedRequestsCopy.findIndex(request => request.uuid === requestUuid);
updatedRequestsCopy[requestIndex] = config.requestBuilder(requestWithOutput[0]);
yield put(change(config.formName, 'requests', updatedRequestsCopy));
}
function mapStateToProps(state) {
return {
options:state.options,
formJSON: getFormValues(REQUEST_FORM_NAME)(state)
}
}
const mapStateToProps = (state) => {
return {...getFormValues(FORM_NAME)(state)}
}
@connect(state => ({
name: selector(state, 'name'),
values: getFormValues('plugin-form')(state),
pluginValues: getFormValues('plugin-settings-form')(state),
}))
export default class PluginForm extends React.Component {
@connect(state => ({
values: getFormValues('api-form')(state),
}))
export default class ApiForm extends React.Component {
function mapStateToProps (state, props) {
return {
values: getFormValues(formName)(state)
}
}
export class EmailSettingForm extends Component {