Fixes infinite loop

This commit is contained in:
zomars 2022-05-17 10:52:45 -06:00
parent a0296b8ccb
commit 683e8c4490
2 changed files with 7 additions and 6 deletions

View File

@ -1,14 +1,13 @@
import { CheckIcon } from "@heroicons/react/outline";
import { GetServerSidePropsContext } from "next";
import { useSession, signOut } from "next-auth/react";
import { getCookieParser } from "next/dist/server/api-utils";
import { signOut, useSession } from "next-auth/react";
import Link from "next/link";
import { useRouter } from "next/router";
import { useEffect } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import Button from "@calcom/ui/Button";
import { useLocale } from "@lib/hooks/useLocale";
import { inferSSRProps } from "@lib/types/inferSSRProps";
import AuthContainer from "@components/ui/AuthContainer";
@ -18,14 +17,15 @@ import { ssrInit } from "@server/lib/ssr";
type Props = inferSSRProps<typeof getServerSideProps>;
export default function Logout(props: Props) {
const { data: session, status } = useSession();
const { status } = useSession();
if (status === "authenticated") signOut({ redirect: false });
const router = useRouter();
useEffect(() => {
if (props.query?.survey === "true") {
router.push("https://cal.com/cancellation");
}
}, [props.query?.survey, router]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.query?.survey]);
const { t } = useLocale();
return (

View File

@ -38,7 +38,8 @@ export default function Provider(props: SSOProviderPageProps) {
} else {
signIn(props.provider);
}
}, [props.isSAMLLoginEnabled, props.product, props.provider, props.tenant, router]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return null;
}