Skip to content

Commit

Permalink
fixed teams null return
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich authored Jul 26, 2023
1 parent 9b0eeb7 commit c56349d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/github/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export class GitHubTeamsApi implements TeamApi {

async getTeamMembers(teamName: string): Promise<string[]> {
// We first verify that this information hasn't been fetched yet
if (this.teamsCache.has(teamName)) {
return this.teamsCache.get(teamName) as string[];
if (!this.teamsCache.has(teamName)) {
this.logger.debug(`Fetching team '${teamName}'`);
// TODO: cache the result
const { data } = await this.api.rest.teams.listMembersInOrg({ org: this.org, team_slug: teamName });
const members = data.map((d) => d.login);
this.teamsCache.set(teamName, members);
}
this.logger.debug(`Fetching team '${teamName}'`);
// TODO: cache the result
const { data } = await this.api.rest.teams.listMembersInOrg({ org: this.org, team_slug: teamName });
const members = data.map((d) => d.login);

return this.teamsCache.get(teamName) as string[];
}
}

0 comments on commit c56349d

Please sign in to comment.