Remove unused TRPC panel code and simplify API handler response

This commit is contained in:
Marco Pedone 2025-08-07 19:38:15 +02:00
parent 5789007b9b
commit cb6e0cee40
2 changed files with 15 additions and 13 deletions

View file

@ -91,7 +91,6 @@
"tailwind-merge": "3.3", "tailwind-merge": "3.3",
"tailwind-scrollbar": "^4.0.2", "tailwind-scrollbar": "^4.0.2",
"tailwindcss": "^4.1.11", "tailwindcss": "^4.1.11",
"trpc-ui": "https://gitpkg.vercel.app/jrhe/trpc-ui/packages/trpc-ui?feature/zod-v4-support&scripts.postinstall=%26%26%20npm%20install%20pnpm%20%26%26%20npm%20install%20--ignore-scripts%20%26%26%20npm%20run%20build",
"tw-animate-css": "^1.3.6", "tw-animate-css": "^1.3.6",
"type-fest": "^4.41.0", "type-fest": "^4.41.0",
"uuid": "^11.1.0", "uuid": "^11.1.0",

View file

@ -1,16 +1,19 @@
import type { NextApiRequest, NextApiResponse } from "next"; import type { NextApiRequest, NextApiResponse } from "next";
import { renderTrpcPanel } from "trpc-ui"; // import { renderTrpcPanel } from "trpc-ui";
import { env } from "~/env.mjs"; // import { env } from "~/env.mjs";
import { appRouter } from "~/server/api/root"; // import { appRouter } from "~/server/api/root";
// export default async function handler(_: NextApiRequest, res: NextApiResponse) {
// if (!env.NEXT_PUBLIC_BASE_URL.includes("localhost")) {
// return res.status(404).send("Not Found");
// }
// res.status(200).send(
// renderTrpcPanel(appRouter, {
// url: `${env.NEXT_PUBLIC_BASE_URL}/api/trpc`,
// transformer: "superjson",
// }),
// );
// }
export default async function handler(_: NextApiRequest, res: NextApiResponse) { export default async function handler(_: NextApiRequest, res: NextApiResponse) {
if (!env.NEXT_PUBLIC_BASE_URL.includes("localhost")) { res.status(404).send("Not Found");
return res.status(404).send("Not Found");
}
res.status(200).send(
renderTrpcPanel(appRouter, {
url: `${env.NEXT_PUBLIC_BASE_URL}/api/trpc`,
transformer: "superjson",
}),
);
} }