(baseUrl: string, cookie: string)
| 69 | }; |
| 70 | |
| 71 | const activeOrg = (baseUrl: string, cookie: string) => |
| 72 | Effect.promise(async () => { |
| 73 | const response = await fetch(new URL("/api/auth/me", baseUrl), { |
| 74 | headers: { cookie }, |
| 75 | }); |
| 76 | if (!response.ok) throw new Error(`/api/auth/me failed (${response.status})`); |
| 77 | const body = (await response.json()) as { |
| 78 | organization: { id: string; name: string; slug: string } | null; |
| 79 | }; |
| 80 | if (!body.organization) throw new Error("identity has no active organization"); |
| 81 | return body.organization; |
| 82 | }); |
| 83 | |
| 84 | const createOrganization = (baseUrl: string, cookie: string, name: string) => |
| 85 | Effect.promise(async () => { |
no test coverage detected