From efe8854d1b56384b5214a58bd73bcc16b776b7c7 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Mon, 6 Nov 2017 22:06:42 -0500 Subject: [PATCH] Hook up editing of pilot name field --- src/features/pilots/PilotDetails.jsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/features/pilots/PilotDetails.jsx b/src/features/pilots/PilotDetails.jsx index 604b690..f052770 100644 --- a/src/features/pilots/PilotDetails.jsx +++ b/src/features/pilots/PilotDetails.jsx @@ -9,6 +9,10 @@ import { selectIsEditingPilot } from "./pilotsSelectors"; +import {updateEntity} from "features/entities/entityActions"; + +import {getValueFromEvent} from "common/utils/clientUtils"; + import { startEditingPilot, @@ -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; @@ -93,6 +105,7 @@ export class PilotDetails extends Component { placeholder="Name" value={name} disabled={!canStopEditing} + onChange={this.onNameChanged} control="input" />