BAEL-4842 - Use React and Spring Boot to Build a Simple CRUD App
Updating PR to reduce complexity of react components Fixing react test
This commit is contained in:
@@ -35,20 +35,20 @@ class ClientEdit extends Component {
|
||||
this.setState({item});
|
||||
}
|
||||
|
||||
async handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
const {item} = this.state;
|
||||
async handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
const {item} = this.state;
|
||||
|
||||
await fetch('/clients' + (item.id ? '/' + item.id : ''), {
|
||||
method: (item.id) ? 'PUT' : 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(item),
|
||||
});
|
||||
this.props.history.push('/clients');
|
||||
}
|
||||
await fetch('/clients' + (item.id ? '/' + item.id : ''), {
|
||||
method: (item.id) ? 'PUT' : 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(item),
|
||||
});
|
||||
this.props.history.push('/clients');
|
||||
}
|
||||
|
||||
render() {
|
||||
const {item} = this.state;
|
||||
|
||||
Reference in New Issue
Block a user