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

Loading...

; } else { if (!session) { window.location.href = "/"; } } function getIntegrations() { fetch('/api/integrations') .then((response) => response.json()) .then((data) => setIntegrations(data)); } // TODO: Stop this function from running repeatedly getIntegrations() 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
{integrations.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

}
); }