import Head from 'next/head'; import Link from 'next/link'; import prisma from '../lib/prisma'; import Shell from '../components/Shell'; import { signIn, useSession, getSession } from 'next-auth/client'; export default function Home(props) { const [ session, loading ] = useSession(); if (loading) { return

Loading...

; } else { if (!session) { window.location.href = "/auth/login"; } } return(
Calendso

Welcome to Calendso!

Get started by connecting your first calendar integration, enabling us to fetch your availability. Head over to the integrations page, and click the add link.

Your integrations

    {props.credentials.map((integration) =>
  • {integration.type == 'google_calendar' && Google Calendar}
    {integration.type == 'google_calendar' &&

    Google Calendar

    } {integration.type == 'google_calendar' &&

    Calendar Integration

    }
  • )} {props.credentials.length == 0 &&

    You haven't added any integrations.

    }
); } export async function getServerSideProps(context) { const session = await getSession(context); let credentials = []; if (session) { const user = await prisma.user.findFirst({ where: { email: session.user.email, }, select: { id: true } }); credentials = await prisma.credential.findMany({ where: { userId: user.id, }, select: { type: true } }); } return { props: {credentials}, // will be passed to the page component as props } }