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

a team

Co-authored-by: Somay Chauhan <somaychauhan98@gmail.com>
Co-authored-by: Amit Sharma <74371312+Amit91848@users.noreply.github.com>
This commit is contained in:
Anik Dhabal Babu
2024-07-29 07:21:56 +03:00
committed by GitHub
co-authored by Somay Chauhan Amit Sharma
parent 8508a6f1a0
commit 2c517f4878
@@ -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)