(target: TargetShape, admin: Identity, member: Identity)
| 114 | /** Invite `member` into `admin`'s org and accept — the real invite flow. |
| 115 | * Returns the member identity with its requests scoped to that org. */ |
| 116 | const joinOrg = (target: TargetShape, admin: Identity, member: Identity) => |
| 117 | Effect.gen(function* () { |
| 118 | const inviteResponse = yield* postJson(target, "/api/account/members/invite", admin, { |
| 119 | email: member.credentials?.email, |
| 120 | }); |
| 121 | const invitation = (yield* Effect.promise(() => inviteResponse.json())) as { id: string }; |
| 122 | const acceptResponse = yield* postJson(target, "/api/auth/accept-invitation", member, { |
| 123 | invitationId: invitation.id, |
| 124 | }); |
| 125 | return withRefreshedSession(member, acceptResponse, orgSelectorOf(admin)); |
| 126 | }); |
| 127 | |
| 128 | /** Create another org for this account; returns the identity bound to it. */ |
| 129 | const createAnotherOrg = (target: TargetShape, identity: Identity, name: string) => |
no test coverage detected