import React from "react"; import {Link} from 'react-router-dom'; import Container from 'react-bootstrap/Container'; import Form from 'react-bootstrap/Form'; import Nav from 'react-bootstrap/Nav'; import Navbar from 'react-bootstrap/Navbar'; import Offcanvas from 'react-bootstrap/Offcanvas'; const header = (props) => { let register = (Register); let login = (Log in); let adminReport = (Check Report); let driverReport = (Check Report); let passengerReport = (Check Report); let isLoggedIn = false let showRegister = register let report if(localStorage.getItem("driverId")){ report = driverReport; isLoggedIn = true; showRegister = ""; } else if(localStorage.getItem("passengerId")) { report = passengerReport; isLoggedIn = true; showRegister = ""; } else if(localStorage.getItem("adminId")){ report = adminReport isLoggedIn = true showRegister = "" } const logoutUser = () => { localStorage.clear() } let logout = ( logoutUser()} className="myButton btn btn-primary" href={"/home"}>Logout); return ( <> {' '} RebuMK RebuMK
{showRegister}
{isLoggedIn ? logout : login}
); } export default header;