Skip to content

Commit

Permalink
Hook up editing of pilot name field
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Nov 7, 2017
1 parent 08b7d9b commit efe8854
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/features/pilots/PilotDetails.jsx
Expand Up @@ -9,6 +9,10 @@ import {
selectIsEditingPilot
} from "./pilotsSelectors";

import {updateEntity} from "features/entities/entityActions";

import {getValueFromEvent} from "common/utils/clientUtils";


import {
startEditingPilot,
Expand Down Expand Up @@ -64,10 +68,18 @@ const mapState = (state) => {
const actions = {
startEditingPilot,
stopEditingPilot,
updateEntity,
}

export class PilotDetails extends Component {

onNameChanged = (e) => {
const newValues = getValueFromEvent(e);
const {id} = this.props.pilot;

this.props.updateEntity("Pilot", id, newValues);
}

render() {
const {pilot={}, pilotIsSelected = false, isEditingPilot = false } = this.props;
const {startEditingPilot, stopEditingPilot} = this.props;
Expand All @@ -93,6 +105,7 @@ export class PilotDetails extends Component {
placeholder="Name"
value={name}
disabled={!canStopEditing}
onChange={this.onNameChanged}
control="input"
/>
<Form.Field
Expand Down

0 comments on commit efe8854

Please sign in to comment.