{props.user.name}
{props.eventType.title}
{props.eventType.length} minutes
{dayjs(date).format("hh:mma, dddd DD MMMM YYYY")}
{props.eventType.description}
import Head from 'next/head'; import Link from 'next/link'; import { useRouter } from 'next/router'; import prisma from '../../lib/prisma'; const dayjs = require('dayjs'); export default function Book(props) { const router = useRouter(); const { date, user } = router.query; const bookingHandler = event => { event.preventDefault(); const res = fetch( '/api/book/' + user, { body: JSON.stringify({ start: dayjs(date).format(), end: dayjs(date).add(props.eventType.length, 'minute').format(), name: event.target.name.value, email: event.target.email.value, notes: event.target.notes.value }), headers: { 'Content-Type': 'application/json' }, method: 'POST' } ); router.push("/success?date=" + date + "&type=" + props.eventType.id + "&user=" + props.user.username); } return (
{props.eventType.length} minutes
{dayjs(date).format("hh:mma, dddd DD MMMM YYYY")}
{props.eventType.description}