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>
This commit is contained in:
Kiran K
2023-04-19 19:32:55 +05:30
committed by GitHub
co-authored by Nafees Nazik nafees nazik
parent a33847a878
commit 2fdadb98ac
+16 -12
View File
@@ -1,5 +1,6 @@
import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { samlProductID, samlTenantID } from "@calcom/features/ee/sso/lib/saml";
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>) {
const router = useRouter();
if (HOSTED_CAL_FEATURES) {
router.push("/auth/login");
return;
}
useEffect(() => {
if (HOSTED_CAL_FEATURES) {
router.push("/auth/login");
}
}, []);
// Initiate SAML authentication flow
signIn(
"saml",
{
callbackUrl: "/",
},
{ tenant: samlTenantID, product: samlProductID }
);
useEffect(() => {
// Initiate SAML authentication flow
signIn(
"saml",
{
callbackUrl: "/",
},
{ tenant: samlTenantID, product: samlProductID }
);
}, []);
return null;
}