import React from 'react'; import { Link, useNavigate } from 'react-router-dom'; import axios from '../../custom-axios/axios'; import CenteredContainer from '../UtilComponents/CenteredContainer'; import '../UtilComponents/App.css' const Home = (props) => { const navigate = useNavigate(); const goToOngoingRequest = async () => { const madeRequestId = localStorage.getItem("madeRequestId") const response = await axios.get(`/request/${madeRequestId}`); navigate("/made-request", {state : {madeRequest: response.data}}) } let drivers = (See drivers); let unapprovedDrivers = (Unapproved drivers); let payments = (Payments); let makeRequest = (Make Request); let ongoingRequest = ( goToOngoingRequest()}>Ongoing Request); let requests = (See Requests) let register = (Register); let login = (Login); let profile = (Profile); let buttonOne let buttonTwo if(localStorage.getItem("driverId")){ buttonOne = requests; buttonTwo = profile; } else if(localStorage.getItem("passengerId")) { buttonOne = drivers if(localStorage.getItem("madeRequestId")){ buttonTwo = ongoingRequest } else { buttonTwo = makeRequest } } else if(localStorage.getItem("adminId")){ buttonOne = unapprovedDrivers buttonTwo = payments } else { buttonOne = login buttonTwo = register } return (

Welcome to RebuMK


{buttonOne}


{buttonTwo}

) } export default Home;