2022-10-18 20:34:32 +00:00
|
|
|
import { useRouter } from "next/router";
|
|
|
|
|
|
|
|
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-01-04 11:00:01 +00:00
|
|
|
import { getSettingsLayout as getLayout, AppSkeletonLoader } from "@calcom/ui";
|
2022-10-18 20:34:32 +00:00
|
|
|
|
|
|
|
import SAMLConfiguration from "../components/SAMLConfiguration";
|
|
|
|
|
|
|
|
const SAMLSSO = () => {
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
if (!HOSTED_CAL_FEATURES) {
|
|
|
|
router.push("/404");
|
|
|
|
}
|
|
|
|
|
|
|
|
const teamId = Number(router.query.id);
|
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const { data: team, isLoading } = trpc.viewer.teams.get.useQuery(
|
|
|
|
{ teamId },
|
|
|
|
{
|
|
|
|
onError: () => {
|
|
|
|
router.push("/settings");
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
2022-10-18 20:34:32 +00:00
|
|
|
|
|
|
|
if (isLoading) {
|
2023-01-04 11:00:01 +00:00
|
|
|
return <AppSkeletonLoader />;
|
2022-10-18 20:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!team) {
|
|
|
|
router.push("/404");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <SAMLConfiguration teamId={teamId} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
SAMLSSO.getLayout = getLayout;
|
|
|
|
|
|
|
|
export default SAMLSSO;
|