import Head from "next/head";
import prisma from "../../lib/prisma";
import Shell from "../../components/Shell";
import SettingsShell from "../../components/Settings";
import { getSession, useSession } from "next-auth/client";
export default function Embed(props) {
const [session, loading] = useSession();
//const router = useRouter(); Unused
if (loading) {
return (
);
}
return (
Embed | Calendso
iframe Embed
The easiest way to embed Calendso on your website.
Calendso API
Leverage our API for full control and customizability.
Browse our API documentation
);
}
export async function getServerSideProps(context) {
const session = await getSession(context);
if (!session) {
return { redirect: { permanent: false, destination: "/auth/login" } };
}
const user = await prisma.user.findFirst({
where: {
email: session.user.email,
},
select: {
id: true,
username: true,
name: true,
email: true,
bio: true,
avatar: true,
timeZone: true,
weekStart: true,
},
});
const BASE_URL = process.env.BASE_URL;
return {
props: { user, BASE_URL }, // will be passed to the page component as props
};
}