import React from "react"; import { useLocation, useNavigate } from 'react-router-dom' import CenteredContainer from "../UtilComponents/CenteredContainer"; import axios from "../../custom-axios/axios"; import '../UtilComponents/App.css' const GradeDrive = (props) => { const location = useLocation(); const navigate = useNavigate(); const [formData, updateFormData] = React.useState({ grade : 0, }) const handleChange = (e) => { updateFormData({ ...formData, [e.target.name]: e.target.value.trim() }) } const onFormSubmit = async (e) => { e.preventDefault() const gradeNum = formData.grade const driveId = location.state.driveId const updatedDrive = await axios.post(`/drive/grade/${driveId}`, null, { params: { gradeNum } }) const requestForDrive = await axios.get(`/request/${updatedDrive.data.request.id}`) console.log(requestForDrive.data.latitude, requestForDrive.data.longitude) navigate("/started-drive", {state: {startedDrive: updatedDrive.data, startLatitude: requestForDrive.data.latitude, startLongitude: requestForDrive.data.longitude}}) } return (


Grade Driver







) } export default GradeDrive;