Skip to content
Snippets Groups Projects
Verified Commit 6ed7b87a authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Send role to server.

parent 1a6679a3
No related branches found
No related tags found
2 merge requests!69Possibility to insert a reservation and new docs.,!64Pass state to avoid controlled component.
......@@ -8,6 +8,8 @@ import {
DialogTitle,
Button,
} from '@material-ui/core';
import { getRoleObject } from 'api/getRoleObject';
import { setReservation } from 'api/setReservation';
import { SubmitHandler, useForm } from 'react-hook-form';
import { InputField } from 'components/Auth/InputField/InputField';
......@@ -30,7 +32,13 @@ export const ReservationDialog: FC<ReservationDialogProps> = ({
const onSubmit: SubmitHandler<InsertReservationProps> = (
reservation: InsertReservationProps,
) => {
setReservation(reservation);
const filledReservation = reservation;
getRoleObject().then((role) => {
filledReservation.insertedBy = role.id;
});
filledReservation.driverShift = '';
console.log(filledReservation);
setReservation(filledReservation);
handleClose();
};
......@@ -57,8 +65,8 @@ export const ReservationDialog: FC<ReservationDialogProps> = ({
/>
<InputField
name="estimatedBeAt"
label="Destination"
type="text"
label="Arrive time"
type="date"
control={control}
/>
<TripStage control={control} />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment