mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-27 19:42:11 +10:00
- Since the form name can be overriden with component props, the initial name is just a default, this changes the var name to communicate that Note: The names of the forms with selectors cannot be changed, otherwise the selector doesn't find the correct data from the Redux store with the initial form name.
22 lines
866 B
JavaScript
22 lines
866 B
JavaScript
import React from 'react';
|
|
import { Field, reduxForm, propTypes as formPropTypes } from 'redux-form';
|
|
import { Button, Input } from '../../components';
|
|
|
|
const ChangePasswordForm = props => {
|
|
const { handleSubmit, pristine, submitting } = props;
|
|
return (
|
|
<form onSubmit={handleSubmit}>
|
|
<label htmlFor="newPassword1">New password</label>
|
|
<Field name="newPassword1" component={Input.fieldComponent} type="password" />
|
|
<label htmlFor="newPassword2">New password, again</label>
|
|
<Field name="newPassword2" component={Input.fieldComponent} type="password" />
|
|
<Button type="submit" disabled={pristine || submitting}>Change password</Button>
|
|
</form>
|
|
);
|
|
};
|
|
|
|
ChangePasswordForm.propTypes = { ...formPropTypes };
|
|
|
|
const defaultFormName = 'ChangePasswordForm';
|
|
|
|
export default reduxForm({ form: defaultFormName })(ChangePasswordForm);
|