mirror of
https://github.com/fspc/workstand.git
synced 2025-02-23 01:13:22 -05:00
Update table when saving.
This commit is contained in:
parent
846d07b894
commit
3d9df8c97b
@ -95,6 +95,8 @@ class BikeForm extends React.Component {
|
||||
throw new Error('Bad response from server');
|
||||
}
|
||||
console.log(response.json());
|
||||
}).then(() => {
|
||||
this.props.getBikes();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,10 @@ export default class BikeModal extends React.Component {
|
||||
open={this.state.open}
|
||||
autoScrollBodyContent
|
||||
>
|
||||
{ this.state.bike ? <BikeForm bike={this.state.bike} editing={this.state.editing} /> : <div>Unable to edit bike.</div>}
|
||||
{ this.state.bike ?
|
||||
<BikeForm bike={this.state.bike} editing={this.state.editing} getBikes={this.props.getBikes} /> :
|
||||
<div>Unable to edit bike.</div>
|
||||
}
|
||||
</Dialog>
|
||||
</div>);
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ export default class BikeTable extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getBikes();
|
||||
}
|
||||
|
||||
getBikes = () => {
|
||||
fetch('/api/v1/bikes/', {
|
||||
credentials: 'same-origin',
|
||||
})
|
||||
@ -119,6 +123,7 @@ export default class BikeTable extends React.Component {
|
||||
bike={this.state.bikeModal.bike}
|
||||
open={this.state.bikeModal.open}
|
||||
editing={this.state.bikeModal.editing}
|
||||
getBikes={this.getBikes}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user