import Head from "next/head"; import prisma from "../../lib/prisma"; import { getIntegrationName, getIntegrationType } from "../../lib/integrations"; import Shell from "../../components/Shell"; import { useState } from "react"; import { useRouter } from "next/router"; import { getSession, useSession } from "next-auth/client"; import Loader from "@components/Loader"; export default function Integration(props) { const router = useRouter(); // eslint-disable-next-line @typescript-eslint/no-unused-vars const [session, loading] = useSession(); const [showAPIKey, setShowAPIKey] = useState(false); if (loading) { return ; } function toggleShowAPIKey() { setShowAPIKey(!showAPIKey); } async function deleteIntegrationHandler(event) { event.preventDefault(); /*eslint-disable */ const response = await fetch("/api/integrations", { method: "DELETE", body: JSON.stringify({ id: props.integration.id }), headers: { "Content-Type": "application/json", }, }); /*eslint-enable */ router.push("/integrations"); } return (
{getIntegrationName(props.integration.type)} App | Calendso

Integration Details

Information about your {getIntegrationName(props.integration.type)} App.

App name
{getIntegrationName(props.integration.type)}
App Category
{getIntegrationType(props.integration.type)}
API Key
{!showAPIKey ? ( •••••••• ) : (
)}

Delete this app

Once you delete this app, it will be permanently removed.

); } export async function getServerSideProps(context) { // eslint-disable-next-line @typescript-eslint/no-unused-vars const session = await getSession(context); const integration = await prisma.credential.findFirst({ where: { id: parseInt(context.query.integration), }, select: { id: true, type: true, key: true, }, }); return { props: { integration }, // will be passed to the page component as props }; }