fix the issue "ReferenceError: window is not defined" (#8193)

Co-authored-by: Nafees Nazik <84864519+G3root@users.noreply.github.com>
Co-authored-by: nafees nazik <nafeesnazik21@gmail.com>
pull/8213/head^2
Kiran K 2023-04-19 19:32:55 +05:30 committed by GitHub
parent a33847a878
commit 2fdadb98ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import { signIn } from "next-auth/react"; import { signIn } from "next-auth/react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useEffect } from "react";
import { samlProductID, samlTenantID } from "@calcom/features/ee/sso/lib/saml"; import { samlProductID, samlTenantID } from "@calcom/features/ee/sso/lib/saml";
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants"; import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
@ -13,19 +14,22 @@ import PageWrapper from "@components/PageWrapper";
export default function Page({ samlTenantID, samlProductID }: inferSSRProps<typeof getServerSideProps>) { export default function Page({ samlTenantID, samlProductID }: inferSSRProps<typeof getServerSideProps>) {
const router = useRouter(); const router = useRouter();
if (HOSTED_CAL_FEATURES) { useEffect(() => {
router.push("/auth/login"); if (HOSTED_CAL_FEATURES) {
return; router.push("/auth/login");
} }
}, []);
// Initiate SAML authentication flow useEffect(() => {
signIn( // Initiate SAML authentication flow
"saml", signIn(
{ "saml",
callbackUrl: "/", {
}, callbackUrl: "/",
{ tenant: samlTenantID, product: samlProductID } },
); { tenant: samlTenantID, product: samlProductID }
);
}, []);
return null; return null;
} }