Fix broken sending page
This commit is contained in:
@@ -8,6 +8,7 @@ import { withRouter } from 'react-router-dom';
|
||||
|
||||
class Form extends React.Component {
|
||||
static defaultProps = {
|
||||
params: {},
|
||||
errors: undefined,
|
||||
fields: undefined,
|
||||
item: undefined,
|
||||
@@ -22,6 +23,10 @@ class Form extends React.Component {
|
||||
id: '',
|
||||
onSubmit: undefined,
|
||||
automationId: '',
|
||||
messages: {
|
||||
onUpdate: () => { /* no-op */ },
|
||||
onCreate: () => { /* no-op */ },
|
||||
},
|
||||
endpoint: undefined,
|
||||
};
|
||||
|
||||
@@ -151,14 +156,15 @@ class Form extends React.Component {
|
||||
};
|
||||
|
||||
handleValueChange = (e) => {
|
||||
const { name, value } = e.target;
|
||||
if (this.props.onChange) {
|
||||
return this.props.onChange(e);
|
||||
}
|
||||
this.setState((prevState) => {
|
||||
const item = prevState.item;
|
||||
const field = e.target.name;
|
||||
const field = name;
|
||||
|
||||
item[field] = e.target.value;
|
||||
item[field] = value;
|
||||
|
||||
return { item };
|
||||
});
|
||||
@@ -259,7 +265,7 @@ class Form extends React.Component {
|
||||
Form.propTypes = {
|
||||
params: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
}).isRequired,
|
||||
}),
|
||||
item: PropTypes.object, // eslint-disable-line react/forbid-prop-types
|
||||
errors: PropTypes.arrayOf(PropTypes.object),
|
||||
endpoint: PropTypes.string,
|
||||
@@ -267,7 +273,7 @@ Form.propTypes = {
|
||||
messages: PropTypes.shape({
|
||||
onUpdate: PropTypes.func,
|
||||
onCreate: PropTypes.func,
|
||||
}).isRequired,
|
||||
}),
|
||||
loading: PropTypes.bool,
|
||||
children: PropTypes.array, // eslint-disable-line react/forbid-prop-types
|
||||
id: PropTypes.string,
|
||||
|
Reference in New Issue
Block a user