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

Function inviteReducer

packages/react/src/pages/org.tsx:122–144  ·  view source on GitHub ↗
(state: InviteState, action: InviteAction)

Source from the content-addressed store, hash-verified

120 | { type: "reset" };
121
122function inviteReducer(state: InviteState, action: InviteAction): InviteState {
123 return Match.value(action).pipe(
124 Match.discriminator("type")("setEmail", (a) => ({
125 ...state,
126 email: a.email,
127 })),
128 Match.discriminator("type")("setRole", (a) => ({
129 ...state,
130 roleSlug: a.roleSlug,
131 })),
132 Match.discriminator("type")("send", () => ({
133 ...state,
134 status: "sending" as const,
135 })),
136 Match.discriminator("type")("error", (a) => ({
137 ...state,
138 status: "error" as const,
139 errorMessage: a.message,
140 })),
141 Match.discriminator("type")("reset", () => initialInviteState),
142 Match.exhaustive,
143 );
144}
145
146// Generic fallback when the server gave no typed reason (a transient failure
147// the admin genuinely can retry). A seat-limit refusal carries its own message.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected