import React, {useEffect} from "react";
import Home from "../components/Home";
import { useNavigate } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import { toast } from "react-toastify";

export default function HomePages() {

  const { drawer } = useSelector((state) => state.drawer);
  const dispatch = useDispatch();
  const navigate = useNavigate();
  const logOut = () => {
    localStorage.removeItem("email");
    localStorage.removeItem('session_token');
    toast.success("Come Back Soon", {
      icon: `🙂`,
    });

    navigate("/login", { replace: true });
  };

  useEffect(()=>{
    setTimeout(()=>{
      logOut()
    }, 300000) //expires user login session after 5 minutes
  },[])
  return (
    <>
      <Home />
    </>
  );
}
