import { useState } from 'react'; import { logout as apiLogout } from '../../lib/api'; export default function LogoutButton() { const [busy, setBusy] = useState(false); async function handleClick() { if (busy) return; setBusy(true); try { await apiLogout(); } catch { /* clear UI anyway */ } window.location.href = '/'; } return ( ); }