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 PayDrive = (props) => { const location = useLocation(); const navigate = useNavigate(); const payDrive = async () => { const driveId = location.state.driveId const totalPriceToPay = location.state.totalSumToPay const response = await axios.post(`/drive/pay/${driveId}`, null, { params: { totalPriceToPay } }); const paymentId = response.data; navigate("/tip-driver", {state: {paymentId: paymentId}}) } return (

You have travelled

{location.state.kmTravelled} km

with a price per km

{location.state.driverPricePerKm} MKD



Your total price to pay is

{(Math.round(location.state.totalSumToPay * 100) / 100).toFixed(2)} MKD


payDrive()}>Pay Drive

) } export default PayDrive;