import { TRPCError } from "@trpc/server";
import type { NextApiRequest, NextApiResponse } from "next";

export const checkCtx = (props: {
	res: NextApiResponse | undefined;
	req: NextApiRequest | undefined;
}) => {
	const { req, res } = props;
	if (!req || !res)
		throw new TRPCError({ code: "BAD_REQUEST", message: "res o req mancanti" });
};
