redirect to cancellation survey (#1570)

pull/1573/head
Syed Ali Shahbaz 2022-01-20 15:02:24 +05:30 committed by GitHub
parent e0a923979a
commit 24182625bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -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<typeof getServerSideProps>;
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,
},
};
}

View File

@ -125,7 +125,7 @@ function SettingsView(props: ComponentProps<typeof Settings> & { 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" });
}