(target: TargetShape, identity: Identity)
| 161 | /** The caller's own account id — the `externalId` the admin plane reports and |
| 162 | * the users page renders in mono. */ |
| 163 | export const accountIdOf = (target: TargetShape, identity: Identity): Effect.Effect<string> => |
| 164 | Effect.promise(async () => { |
| 165 | const response = await fetch(new URL("/api/account/me", target.baseUrl), { |
| 166 | headers: { cookie: cookieOf(identity) }, |
| 167 | }); |
| 168 | if (!response.ok) throw new Error(`/api/account/me failed (${response.status})`); |
| 169 | const body = (await response.json()) as { user: { id: string } }; |
| 170 | return body.user.id; |
| 171 | }); |
| 172 | |
| 173 | /** The org this identity's session is currently bound to: id and URL slug. */ |
| 174 | export const activeOrg = ( |
no test coverage detected