Skip to content

Scheduling infrastructure for absolutely everyone.

fix: prisma not defined

Agusti Fernandez Pardofc4d0ab3ea82
diff --git a/pages/api/me/_get.ts b/pages/api/me/_get.ts
index 40a518f9ae5..1ae8d47d82c 100644
--- a/pages/api/me/_get.ts
+++ b/pages/api/me/_get.ts
@@ -6,11 +6,14 @@ import { schemaUserReadPublic } from "@lib/validations/user";
import { User } from ".prisma/client";
-async function handler(req: NextApiRequest): Promise<{ error?: string; user?: Partial<User> }> {
+async function handler({
+ userId,
+ prisma,
+}: NextApiRequest): Promise<{ error?: string; user?: Partial<User> }> {
+ const data = await prisma.user.findUniqueOrThrow({ where: { id: userId } });
if (!prisma) return { error: "Cant connect to database" };
- console.log(req);
- if (!req.userId) return { error: "No user id found" };
- const data = await prisma.user.findUniqueOrThrow({ where: { id: req.userId } });
+
+ if (!userId) return { error: "No user id found" };
if (!data) return { error: "You need to pass apiKey" };
const user = schemaUserReadPublic.parse(data);
return { user };