cal.pub0.org/apps/web/pages/api/cancel.ts

18 lines
638 B
TypeScript
Raw Normal View History

import type { NextApiRequest } from "next";
import handleCancelBooking from "@calcom/features/bookings/lib/handleCancelBooking";
import { getSession } from "@calcom/lib/auth";
import { defaultResponder, defaultHandler } from "@calcom/lib/server";
async function handler(req: NextApiRequest & { userId?: number }) {
const session = await getSession({ req });
/* To mimic API behavior */
req.userId = session?.user?.id;
return await handleCancelBooking(req);
2021-07-15 21:34:55 +00:00
}
export default defaultHandler({
DELETE: Promise.resolve({ default: defaultResponder(handler) }),
POST: Promise.resolve({ default: defaultResponder(handler) }),
});