| 249 | memberships.data.filter((m) => m.status === "active").map((m) => m.organizationId), |
| 250 | ); |
| 251 | const activeOrganizationFor = (slug: string) => |
| 252 | users |
| 253 | .use("getOrganizationBySlug", (s) => s.getOrganizationBySlug(slug)) |
| 254 | .pipe( |
| 255 | Effect.map((org) => (org && activeOrganizationIds.has(org.id) ? org.id : null)), |
| 256 | Effect.orElseSucceed(() => null), |
| 257 | ); |
| 258 | |
| 259 | // Prefer the org in the URL that sent the user to login. If the URL |
| 260 | // is bare, or not an org route, prefer the org this browser last |