import Head from 'next/head'; import Link from 'next/link'; import prisma from '../../lib/prisma'; import Shell from '../../components/Shell'; import { useState } from 'react'; import { useSession, getSession } from 'next-auth/client'; import { CheckCircleIcon, XCircleIcon, ChevronRightIcon, PlusIcon } from '@heroicons/react/solid'; import { InformationCircleIcon } from '@heroicons/react/outline'; 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 integrationHandler(type) { fetch('/api/integrations/' + type + '/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.

  • Office 365 / Outlook.com Calendar

    Office 365 / Outlook.com Calendar

    For personal and business accounts

  • 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: { id: true, type: true, key: true } }); return { props: {credentials}, // will be passed to the page component as props } }