import { useState } from "react"; import { teamApi } from "../api/team"; import type { Invite } from "../types"; import { Modal } from "./Modal"; export function InviteDialog({ onInvited, onClose }: { onInvited: (invite: Invite) => void; onClose: () => void }) { const [email, setEmail] = useState(""); const [error, setError] = useState(null); const [sending, setSending] = useState(false); const send = async () => { setSending(true); setError(null); try { onInvited(await teamApi.invite(email.trim())); onClose(); } catch (e) { setError((e as Error).message); } finally { setSending(false); } }; return (
{ e.preventDefault(); void send(); }} > {error &&

{error}

}
); }