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