Home.js 429 Bytes
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";

const Home = () => {
  const session = localStorage.getItem("session");
  console.log("visit Home");

  let destination;
  if (session) {
    destination = "/calendar/month";
  } else {
    destination = "/login";
  }

  const navigate = useNavigate();
  useEffect(() => navigate(destination), [destination, navigate]);
};

export default Home;