Skip to content

Commit

Permalink
refactor: set configs username prop, no mutating
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Oct 11, 2023
1 parent a36f946 commit 13dd085
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/org/org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -798,13 +798,13 @@ export class Org extends AsyncOptionalCreatable<Org.Options> {
this.logger.debug(`removing username ${authInfo.getFields().username}`);

const orgConfig: OrgUsersConfig = await this.retrieveOrgUsersConfig();

const contents: ConfigContents = await orgConfig.read();
const contents = await orgConfig.read();

const targetUser = authInfo.getFields().username;
const usernames = (contents.usernames ?? []) as string[];
contents.usernames = usernames.filter((username) => username !== targetUser);

const usernames = (contents.usernames ?? []).filter((username) => username !== targetUser);

orgConfig.set('usernames', usernames);
await orgConfig.write();
return this;
}
Expand Down

0 comments on commit 13dd085

Please sign in to comment.