{"size": 565, "ext": "js", "max_stars_repo_path": "medcab3/src/components/LogoutHeader.js", "max_stars_repo_name": "easpaas/medcab_frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "medcab3/src/components/LogoutHeader.js", "max_issues_repo_name": "easpaas/medcab_frontend", "max_issues_repo_issues_event_min_datetime": "2020-04-28T22:44:31.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-30T15:47:03.000Z", "max_forks_repo_path": "medcab3/src/components/LogoutHeader.js", "max_forks_repo_name": "easpaas/medcab_frontend", "max_forks_repo_forks_event_min_datetime": "2020-04-27T16:59:30.000Z", "max_forks_repo_forks_event_max_datetime": "2020-05-01T20:27:04.000Z"}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": 2, "avg_line_length": 22.6, "max_line_length": 60, "alphanum_fraction": 0.6}
import React  from "react";
import {Link, useHistory} from 'react-router-dom';
import '../App.css';

export const LogoutHeader = ({userId, setIsLoggedIn}) => {
  const { push } = useHistory();


  const handleLogout = () => {
    localStorage.clear();
    setIsLoggedIn(false);
    push("/login");
  }  

  return (
    <div className="header">
      <a href="https://thepotcab.netlify.app/">Marketing</a>
      <Link to={`/protected/${userId}`}>Home</Link>
      <button className="button" onClick={handleLogout}>
        Logout
      </button>
    </div>
  );
};
