2022-10-18 20:34:32 +00:00
|
|
|
import { useRouter } from "next/router";
|
|
|
|
|
|
|
|
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
|
2023-01-24 20:02:43 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-10-18 20:34:32 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-01-05 17:00:16 +00:00
|
|
|
import { AppSkeletonLoader as SkeletonLoader } from "@calcom/ui";
|
2023-01-24 20:02:43 +00:00
|
|
|
import { Meta } from "@calcom/ui";
|
2022-10-18 20:34:32 +00:00
|
|
|
|
2023-01-05 17:00:16 +00:00
|
|
|
import { getLayout } from "../../../settings/layouts/SettingsLayout";
|
2023-01-24 20:02:43 +00:00
|
|
|
import SSOConfiguration from "../components/SSOConfiguration";
|
2022-10-18 20:34:32 +00:00
|
|
|
|
|
|
|
const SAMLSSO = () => {
|
2023-01-24 20:02:43 +00:00
|
|
|
const { t } = useLocale();
|
2022-10-18 20:34:32 +00:00
|
|
|
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-05 17:00:16 +00:00
|
|
|
return <SkeletonLoader />;
|
2022-10-18 20:34:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!team) {
|
|
|
|
router.push("/404");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-01-24 20:02:43 +00:00
|
|
|
return (
|
|
|
|
<div className="w-full bg-white sm:mx-0 xl:mt-0">
|
|
|
|
<Meta title={t("sso_configuration")} description={t("sso_configuration_description")} />
|
|
|
|
<SSOConfiguration teamId={teamId} />
|
|
|
|
</div>
|
|
|
|
);
|
2022-10-18 20:34:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SAMLSSO.getLayout = getLayout;
|
|
|
|
|
|
|
|
export default SAMLSSO;
|