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');
|
throw new Error('Bad response from server');
|
||||||
}
|
}
|
||||||
console.log(response.json());
|
console.log(response.json());
|
||||||
|
}).then(() => {
|
||||||
|
this.props.getBikes();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,10 @@ export default class BikeModal extends React.Component {
|
|||||||
open={this.state.open}
|
open={this.state.open}
|
||||||
autoScrollBodyContent
|
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>
|
</Dialog>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,10 @@ export default class BikeTable extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.getBikes();
|
||||||
|
}
|
||||||
|
|
||||||
|
getBikes = () => {
|
||||||
fetch('/api/v1/bikes/', {
|
fetch('/api/v1/bikes/', {
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
})
|
})
|
||||||
@ -119,6 +123,7 @@ export default class BikeTable extends React.Component {
|
|||||||
bike={this.state.bikeModal.bike}
|
bike={this.state.bikeModal.bike}
|
||||||
open={this.state.bikeModal.open}
|
open={this.state.bikeModal.open}
|
||||||
editing={this.state.bikeModal.editing}
|
editing={this.state.bikeModal.editing}
|
||||||
|
getBikes={this.getBikes}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user