MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / handleAccept

Function handleAccept

apps/cloud/src/web/pages/create-org.tsx:52–72  ·  view source on GitHub ↗
(invitation: PendingInvitation)

Source from the content-addressed store, hash-verified

50 const [errorByInvitationId, setErrorByInvitationId] = useState<Record<string, string>>({});
51
52 const handleAccept = async (invitation: PendingInvitation) => {
53 setAcceptingId(invitation.id);
54 setErrorByInvitationId((prev) => {
55 if (!(invitation.id in prev)) return prev;
56 const next = { ...prev };
57 delete next[invitation.id];
58 return next;
59 });
60 const exit = await doAccept({
61 payload: { invitationId: invitation.id },
62 reactivityKeys: authWriteKeys,
63 });
64 setAcceptingId(null);
65 trackEvent("org_invitation_accepted", { success: Exit.isSuccess(exit) });
66 if (!Exit.isSuccess(exit)) {
67 setErrorByInvitationId((prev) => ({
68 ...prev,
69 [invitation.id]: "Couldn't accept this invitation. Try again or ask the inviter to resend.",
70 }));
71 }
72 };
73
74 const suggestedName =
75 auth.status === "authenticated" && auth.user.name != null && auth.user.name.trim() !== ""

Callers 1

CreateOrgPageFunction · 0.85

Calls 1

trackEventFunction · 0.90

Tested by

no test coverage detected