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";
|
2022-11-23 02:55:25 +00:00
|
|
|
import { getSettingsLayout as getLayout, SkeletonLoader } 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) {
|
|
|
|
return <SkeletonLoader />;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!team) {
|
|
|
|
router.push("/404");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <SAMLConfiguration teamId={teamId} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
SAMLSSO.getLayout = getLayout;
|
|
|
|
|
|
|
|
export default SAMLSSO;
|