import type { GetServerSidePropsContext } from "next"; import { getProviders, signIn, getCsrfToken } from "next-auth/react"; import { getServerSession } from "@calcom/features/auth/lib/getServerSession"; import { Button } from "@calcom/ui"; type Provider = { name: string; id: string; }; function signin({ providers }: { providers: Provider[] }) { return (
{Object.values(providers).map((provider) => { return (
); })}
); } export default signin; export async function getServerSideProps(context: GetServerSidePropsContext) { const { req, res } = context; const session = await getServerSession({ req, res }); const csrfToken = await getCsrfToken(context); const providers = await getProviders(); if (session) { return { redirect: { destination: "/" }, }; } return { props: { csrfToken, providers, }, }; }