import { CalendarIcon, XIcon } from "@heroicons/react/outline"; import { ArrowRightIcon } from "@heroicons/react/solid"; import dayjs from "dayjs"; import { getSession } from "next-auth/client"; import { useRouter } from "next/router"; import { useState } from "react"; import { useEffect } from "react"; import prisma from "@lib/prisma"; import { HeadSeo } from "@components/seo/head-seo"; import Button from "@components/ui/Button"; export default function MeetingUnavailable(props) { const router = useRouter(); // eslint-disable-next-line @typescript-eslint/no-unused-vars const [is24h, setIs24h] = useState(false); //if no booking redirectis to the 404 page const emptyBooking = props.booking === null; useEffect(() => { if (emptyBooking) { router.push("/call/no-meeting-found"); } }); if (!emptyBooking) { return (
); } return null; } export async function getServerSideProps(context) { const booking = await prisma.booking.findUnique({ where: { uid: context.query.uid, }, select: { uid: true, id: true, title: true, description: true, startTime: true, endTime: true, user: { select: { credentials: true, }, }, attendees: true, dailyRef: { select: { dailyurl: true, dailytoken: true, }, }, references: { select: { uid: true, type: true, }, }, }, }); if (!booking) { // TODO: Booking is already cancelled return { props: { booking: null }, }; } const bookingObj = Object.assign({}, booking, { startTime: booking.startTime.toString(), endTime: booking.endTime.toString(), }); const session = await getSession(); return { props: { booking: bookingObj, session: session, }, }; }