(target: TargetShape, admin: Identity, member: Identity)
| 96 | /** Invite `member` into `admin`'s org and accept — the real invite flow. |
| 97 | * Returns the member identity with its session re-bound to that org. */ |
| 98 | const joinOrg = (target: TargetShape, admin: Identity, member: Identity) => |
| 99 | Effect.gen(function* () { |
| 100 | const inviteResponse = yield* postJson(target, "/api/account/members/invite", admin, { |
| 101 | email: member.credentials?.email, |
| 102 | }); |
| 103 | const invitation = (yield* Effect.promise(() => inviteResponse.json())) as { id: string }; |
| 104 | const acceptResponse = yield* postJson(target, "/api/auth/accept-invitation", member, { |
| 105 | invitationId: invitation.id, |
| 106 | }); |
| 107 | return withRefreshedSession(member, acceptResponse); |
| 108 | }); |
| 109 | |
| 110 | /** Create another org for this account; returns the identity bound to it. */ |
| 111 | const createAnotherOrg = (target: TargetShape, identity: Identity, name: string) => |
no test coverage detected