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 { 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,11 +14,13 @@ import PageWrapper from "@components/PageWrapper";
export default function Page({ samlTenantID, samlProductID }: inferSSRProps<typeof getServerSideProps>) {
const router = useRouter();
useEffect(() => {
if (HOSTED_CAL_FEATURES) {
router.push("/auth/login");
return;
}
}, []);
useEffect(() => {
// Initiate SAML authentication flow
signIn(
"saml",
@ -26,6 +29,7 @@ export default function Page({ samlTenantID, samlProductID }: inferSSRProps<type
},
{ tenant: samlTenantID, product: samlProductID }
);
}, []);
return null;
}