import { GetServerSidePropsContext } from "next"; import { signOut, useSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useEffect } from "react"; import { WEBSITE_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Button, Icon } from "@calcom/ui"; import { inferSSRProps } from "@lib/types/inferSSRProps"; import AuthContainer from "@components/ui/AuthContainer"; import { ssrInit } from "@server/lib/ssr"; type Props = inferSSRProps; export default function Logout(props: Props) { const { status } = useSession(); if (status === "authenticated") signOut({ redirect: false }); const router = useRouter(); useEffect(() => { if (props.query?.survey === "true") { router.push(`${WEBSITE_URL}/cancellation`); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.query?.survey]); const { t } = useLocale(); return (

{t("hope_to_see_you_soon")}

); } export async function getServerSideProps(context: GetServerSidePropsContext) { const ssr = await ssrInit(context); // Deleting old cookie manually, remove this code after all existing cookies have expired context.res.setHeader( "Set-Cookie", "next-auth.session-token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;" ); return { props: { trpcState: ssr.dehydrate(), query: context.query, }, }; }