Update to stage-3.

This commit is contained in:
Drew Larson
2017-05-23 19:29:56 -06:00
parent 2219366859
commit 7c2df81c6a
8 changed files with 34 additions and 90 deletions
@@ -75,7 +75,7 @@ class BikeForm extends React.Component {
});
}
handleSave = () => {
handleSave() {
const id = this.state.bike.id;
const data = JSON.stringify(this.state.bike);
const csrfToken = Cookies.get('csrftoken');
@@ -99,7 +99,7 @@ class BikeForm extends React.Component {
});
}
render = () => {
render() {
const timezone = moment.tz.guess();
const {
claimed_at,
@@ -255,4 +255,8 @@ class BikeForm extends React.Component {
}
}
BikeForm.propTypes = {
editing: PropTypes.bool,
handleClose: PropTypes.func,
}
export default BikeForm;
@@ -6,13 +6,7 @@ import BikeForm from '../BikeForm';
/**
* A modal dialog can only be closed by selecting one of the actions.
*/
export default class BikeModal extends React.Component {
static propTypes = {
open: PropTypes.bool,
bike: PropTypes.object,
editing: PropTypes.bool,
}
class BikeModal extends React.Component {
constructor(props) {
super(props);
@@ -23,7 +17,7 @@ export default class BikeModal extends React.Component {
};
}
componentWillReceiveProps = (newProps) => {
componentWillReceiveProps(newProps) {
this.setState({
...this.state,
open: newProps.open || false,
@@ -32,7 +26,7 @@ export default class BikeModal extends React.Component {
});
}
handleClose = () => {
handleClose() {
this.setState({ open: false });
};
@@ -63,3 +57,9 @@ export default class BikeModal extends React.Component {
</div>);
}
}
export default BikeModal.propTypes = {
open: PropTypes.bool,
bike: PropTypes.object,
editing: PropTypes.bool,
};
@@ -42,19 +42,6 @@ export default class BikeTable extends React.Component {
}
getBikes = () => {
fetch('/api/v1/bikes/', {
credentials: 'same-origin',
})
.then(checkStatus)
.then(parseJSON)
.then((data) => {
this.setState({ bikes: data });
})
.catch((error) => {
console.log('request failed', error);
});
}
handleEditBike(bike) {
this.setState({
...this.state,
@@ -66,7 +53,7 @@ export default class BikeTable extends React.Component {
});
}
handleAddBike = () => {
handleAddBike() {
this.setState({
...this.state,
bikeModal: {