From a72fbfa0933d9f90951a66aa8d75dc636c880007 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo <6601142+agustif@users.noreply.github.com> Date: Fri, 8 Jul 2022 19:33:37 +0200 Subject: [PATCH] Update pages/api/availability/_get.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit improve error message team no members Co-authored-by: Omar López --- pages/api/availability/_get.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/api/availability/_get.ts b/pages/api/availability/_get.ts index 0d9afa6100..894df6b8cb 100644 --- a/pages/api/availability/_get.ts +++ b/pages/api/availability/_get.ts @@ -37,7 +37,7 @@ async function handler(req: NextApiRequest) { select: { members: true }, }); if (!team) throw new HttpError({ statusCode: 404, message: "teamId not found" }); - if (!team.members) throw new HttpError({ statusCode: 404, message: "teamId not found" }); + if (!team.members) throw new HttpError({ statusCode: 404, message: "team has no members" }); const allMemberIds = team.members.map((membership) => membership.userId); const members = await prisma.user.findMany({ where: { id: { in: allMemberIds } },