fix: getting an error when a team member tries to leave (#15925)

a team

Co-authored-by: Somay Chauhan <[email protected]>
Co-authored-by: Amit Sharma <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-07-29 07:21:56 +03:00
1 parent 8508a6f1a0
commit 2c517f4878
1 file changed
+4 -1
@@ -28,7 +28,10 @@ export const removeMemberHandler = async ({ ctx, input }: RemoveMemberOptions) =
});
const { memberIds, teamIds, isOrg } = input;
const isAdmin = teamIds.every(async (teamId) => await isTeamAdmin(ctx.user.id, teamId));
const isAdmin = await Promise.all(
teamIds.map(async (teamId) => await isTeamAdmin(ctx.user.id, teamId))
).then((results) => results.every((result) => result));
const isOrgAdmin = ctx.user.profile?.organizationId
? await isTeamAdmin(ctx.user.id, ctx.user.profile?.organizationId)