import { useContext, useState } from 'react'; import { AuthContext } from '../App.jsx'; import { logout as apiLogout } from '../api.js'; export default function Topbar({ archives, archiveId, onArchiveChange, view, onViewChange, onCaptureClick }) { const { currentUser, setCurrentUser } = useContext(AuthContext) ?? {}; const [loggingOut, setLoggingOut] = useState(false); async function handleLogout() { setLoggingOut(true); await apiLogout(); setCurrentUser(null); window.location.reload(); } return (
Archivr
{currentUser && (
{currentUser.display_name || currentUser.username}
)}
); }