18 lines
638 B
TypeScript
18 lines
638 B
TypeScript
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);
|
|
}
|
|
|
|
export default defaultHandler({
|
|
DELETE: Promise.resolve({ default: defaultResponder(handler) }),
|
|
POST: Promise.resolve({ default: defaultResponder(handler) }),
|
|
});
|