import { useEffect, useState } from "react"; import { BrowserRouter, Routes, Route } from "react-router-dom"; import { api } from "./api/client"; import { Login } from "./pages/Login"; import { InstallationList } from "./pages/InstallationList"; import { InstallationDetail } from "./pages/InstallationDetail"; export function App() { const [authenticated, setAuthenticated] = useState(null); useEffect(() => { api.session().then((s) => setAuthenticated(s.authenticated)); }, []); if (authenticated === null) return null; if (!authenticated) return setAuthenticated(true)} />; const onLoggedOut = () => setAuthenticated(false); return ( } /> } /> ); }