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

Loading...

; } else { if (!session) { window.location.href = "/"; } } function toggleAddModal() { setShowAddModal(!showAddModal); } function googleCalendarHandler() { fetch('/api/integrations/googlecalendar/add') .then((response) => response.json()) .then((data) => window.location.href = data.url); } return (
Integrations | Calendso
{props.credentials.length == 0 &&

You don't have any integrations added.

You currently do not have any integrations set up. Add your first integration to get started.

}
{showAddModal &&
{/* */} {/* */}

Link a new integration to your account.

  • Google Calendar

    Google Calendar

    For personal and business accounts

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