diff --git a/pages/auth/logout.tsx b/pages/auth/logout.tsx index 7bc85f0e6e..a92bb20146 100644 --- a/pages/auth/logout.tsx +++ b/pages/auth/logout.tsx @@ -1,14 +1,25 @@ import { CheckIcon } from "@heroicons/react/outline"; import { GetServerSidePropsContext } from "next"; import Link from "next/link"; +import { useRouter } from "next/router"; +import { useEffect } from "react"; import { useLocale } from "@lib/hooks/useLocale"; +import { inferSSRProps } from "@lib/types/inferSSRProps"; import { HeadSeo } from "@components/seo/head-seo"; import { ssrInit } from "@server/lib/ssr"; -export default function Logout() { +type Props = inferSSRProps; + +export default function Logout(props: Props) { + const router = useRouter(); + useEffect(() => { + if (props.query?.survey === "true") { + router.push("https://cal.com/cancellation"); + } + }, []); const { t } = useLocale(); return ( @@ -55,6 +66,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { return { props: { trpcState: ssr.dehydrate(), + query: context.query, }, }; } diff --git a/pages/settings/profile.tsx b/pages/settings/profile.tsx index c7ffa9e48f..164dfee8a3 100644 --- a/pages/settings/profile.tsx +++ b/pages/settings/profile.tsx @@ -125,7 +125,7 @@ function SettingsView(props: ComponentProps & { localeProp: str console.error(`Error Removing user: ${props.user.id}, email: ${props.user.email} :`, e); }); if (process.env.NEXT_PUBLIC_BASE_URL === "https://app.cal.com") { - signOut({ callbackUrl: "https://cal.com/cancellation" }); + signOut({ callbackUrl: "/auth/logout?survey=true" }); } else { signOut({ callbackUrl: "/auth/logout" }); }