diff --git a/pages/cancel/[uid].tsx b/pages/cancel/[uid].tsx index 73efeafd46..a4637cc4c3 100644 --- a/pages/cancel/[uid].tsx +++ b/pages/cancel/[uid].tsx @@ -49,7 +49,7 @@ export default function Type(props) { ); if(res.status >= 200 && res.status < 300) { - router.push('/cancel/success'); + router.push('/cancel/success?user=' + props.user.username + '&title=' + props.eventType.title); } else { setLoading(false); setError("An error with status code " + res.status + " occurred. Please try again later."); diff --git a/pages/cancel/success.tsx b/pages/cancel/success.tsx new file mode 100644 index 0000000000..749de20e88 --- /dev/null +++ b/pages/cancel/success.tsx @@ -0,0 +1,98 @@ +import {useState} from 'react'; +import Head from 'next/head'; +import prisma from '../../lib/prisma'; +import {useRouter} from 'next/router'; +import dayjs from 'dayjs'; +import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'; +import isBetween from 'dayjs/plugin/isBetween'; +import utc from 'dayjs/plugin/utc'; +import timezone from 'dayjs/plugin/timezone'; +import {CheckIcon} from "@heroicons/react/outline"; + +dayjs.extend(isSameOrBefore); +dayjs.extend(isBetween); +dayjs.extend(utc); +dayjs.extend(timezone); + +function classNames(...classes) { + return classes.filter(Boolean).join(' ') +} + +export default function Type(props) { + // Get router variables + const router = useRouter(); + + const [is24h, setIs24h] = useState(false); + + return ( +
+ + + Cancelled {props.title} | {props.user.name || props.user.username} | + Calendso + + + +
+
+
+ +
+
+
+
+ ); +} + +export async function getServerSideProps(context) { + const user = await prisma.user.findFirst({ + where: { + username: context.query.user, + }, + select: { + username: true, + name: true, + bio: true, + avatar: true, + eventTypes: true + } + }); + + return { + props: { + user, + title: context.query.title + }, + } +}