import { Routes, Route,  Navigate } from "react-router-dom";
import Login from "./components/TopLevel/Login/Index";
import SeatBooking from "./components/TopLevel/SeatBooking/Index";
import { getItem } from '../src/utils/localStorage'
const Navigates = () => {
   
   const isAuthenticated = getItem("user");
   const RequireAuth = ({ children }) => {
      return isAuthenticated ? children : <Navigate to="/login" replace />;
   };
   return (
      <Routes>
         <Route path="/login" element={<Login />} />
         <Route path="/" element={
            <RequireAuth>
               <SeatBooking />
            </RequireAuth>
         } />
      </Routes>
   )
}

export default Navigates