);
}
function App() {
const [session, setSession] = useState(null);
const [booting, setBooting] = useState(true);
// Restore the session on load: the cookie is HttpOnly, so /me is the only way
// to recover who we are (and whether to show the admin nav) after a refresh.
useEffect(() => {
api.me()
.then((r) => setSession({ username: r.data.username, role: r.data.role }))
.catch(() => setSession(null)) // 401 / offline → show Login
.finally(() => setBooting(false));
}, []);
if (booting) {
return