Files
calendar/apps/web/modules/onboarding/hooks/useMigrationFlow.ts
T
sean-brydonandGitHub a359f0ba01 feat: organization upgrade flow v3 (#25972)
* wip flow

* add tests

* WIP migrateing view

* push back step

* fix tests and logic for adding new members to existing teams

* few UI fixes

* type fixes

* fix nits

* few UI + re-route fixes

* fix teamId when migrating
2026-01-26 17:03:12 +01:00

25 lines
598 B
TypeScript

"use client";
import { useSearchParams } from "next/navigation";
import { trpc } from "@calcom/trpc/react";
export const useMigrationFlow = () => {
const searchParams = useSearchParams();
const migrateParam = searchParams?.get("migrate");
const isMigrationFlow = migrateParam === "true";
const { data: teams, isLoading } = trpc.viewer.teams.listOwnedTeams.useQuery(undefined, {
enabled: isMigrationFlow, // Only fetch if migration flow
});
const hasTeams = (teams?.length ?? 0) > 0;
return {
isMigrationFlow,
hasTeams,
teams: teams ?? [],
isLoading,
};
};