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