diff --git a/client/src/components/appointment/UpdateAppointment.js b/client/src/components/appointment/UpdateAppointment.js index b54823d..32b1e10 100644 --- a/client/src/components/appointment/UpdateAppointment.js +++ b/client/src/components/appointment/UpdateAppointment.js @@ -14,6 +14,7 @@ const ONE_APPOINTMENT_QUERY = gql` _id title description + type start end } @@ -24,14 +25,16 @@ const UPDATE_APPOINTMENT_MUTATION = gql` mutation UpdateAppointmentMutation( $_id: ID! $title: String! - $description: String! - $start: String! - $end: String! + $description: String + $type: String! + $start: DateTime! + $end: DateTime! ) { updateAppointment(title: $title, description: $description, start: $start, end: $end) { _id title description + type start end } @@ -48,11 +51,12 @@ const UpdateAppointment = ({ match: { params: { _id } } }) => { }); let [formState, setFormState] = useState({ - _id: '', - title: '', - description: '', - start: '', - end: '' + // _id: '', + // title: '', + // description: '', + // type: '', + // start: '', + // end: '' }); const [updateAppointment] = useMutation(UPDATE_APPOINTMENT_MUTATION, { @@ -60,6 +64,7 @@ const UpdateAppointment = ({ match: { params: { _id } } }) => { _id: formState._id, title: formState.title, description: formState.description, + type: formState.type, start: formState.start, end: formState.end }, @@ -69,6 +74,9 @@ const UpdateAppointment = ({ match: { params: { _id } } }) => { if (data === undefined) { return
Loading...
} else { + // setFormState({ + // formState.title= data.oneAppointment.title + // }) return (
@@ -88,7 +96,7 @@ const UpdateAppointment = ({ match: { params: { _id } } }) => { /> setFormState({ ...formState, @@ -110,6 +118,18 @@ const UpdateAppointment = ({ match: { params: { _id } } }) => { type="text" placeholder="Input description" /> + + setFormState({ + ...formState, + type: e.target.value + }) + } + type="text" + placeholder="Input description" + />