import { useNavigate } from "react-router-dom";
import useAuth from "../../auth/auth";

import { Link } from 'react-router-dom';
import useLogout from "../../auth/logout"


const Home = () => {
  const { setToken } = useAuth();
  const navigate = useNavigate();

  const handleLogout = () => {
    setToken(null);
    navigate("/login");
  };

  return (
    <div>
      <h2>Home</h2>
      <button onClick={handleLogout}>
        Logout
      </button>
      <nav>
        <ul>
          <li>
            <Link to="/">Home</Link>
          </li>
          <li>
            <Link to="/login">Login</Link>
          </li>
          <li>
            <Link to="/register">Register</Link>
          </li>
          <li>
            <Link to="/dashboard">Dashboard</Link>
          </li>
        </ul>
      </nav>
    </div>
  )
}

export default Home;
