import { useEffect, useContext, lazy, Suspense } from "react"; import "./App.css"; const Home = lazy(() => import("./Pages/Home")); const Series = lazy(() => import("./Pages/Series")); const Search = lazy(() => import("./Pages/Search")); const Profile = lazy(() => import("./Pages/Profile")); const MyList = lazy(() => import("./Pages/MyList")); const SignIn = lazy(() => import("./Pages/SignIn")); const SignUp = lazy(() => import("./Pages/SignUp")); const Welcome = lazy(() => import("./Pages/Welcome")); const ErrorPage = lazy(() => import("./Pages/ErrorPage")); const Play = lazy(() => import("./Pages/Play")); const LikedMovies = lazy(() => import("./Pages/LikedMovies")); const History = lazy(() => import("./Pages/History")); import { Routes, Route, Navigate } from "react-router-dom"; import { AuthContext } from "./Context/UserContext"; import { getAuth, onAuthStateChanged } from "firebase/auth"; import Loading from "./componets/Loading/Loading"; import Navbar from "./componets/Header/Navbar"; import NavbarWithoutUser from "./componets/Header/NavbarWithoutUser"; function App() { const { User, setUser } = useContext(AuthContext); useEffect(() => { const auth = getAuth(); onAuthStateChanged(auth, (user) => { setUser(user); console.log(user); }); }, []); return (
{User ? : } }> : } /> {User ? ( <> } /> } /> } /> } /> } /> } /> } /> } /> ) : null} } /> } /> } /> } />
); } export default App;