(baseUrl: string, cookie: string)
| 102 | }); |
| 103 | |
| 104 | const activeOrg = (baseUrl: string, cookie: string) => |
| 105 | Effect.promise(async () => { |
| 106 | const response = await fetch(new URL("/api/auth/me", baseUrl), { |
| 107 | headers: { cookie }, |
| 108 | }); |
| 109 | if (!response.ok) throw new Error(`/api/auth/me failed (${response.status})`); |
| 110 | const body = (await response.json()) as { |
| 111 | organization: { id: string; name: string; slug: string } | null; |
| 112 | }; |
| 113 | if (!body.organization) throw new Error("identity has no active organization"); |
| 114 | return body.organization; |
| 115 | }); |
| 116 | |
| 117 | const createOrganization = (baseUrl: string, cookie: string, name: string) => |
| 118 | Effect.promise(async () => { |
no test coverage detected