Skip to content

Commit

Permalink
SP-12517 -methods without arguments guard
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyIlchenko committed Nov 22, 2023
1 parent a6b8bca commit 670d7f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/ext/group-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export class GroupApi {
}

async createGroup(groupToCreate: GroupToCreate, xRequestID?: string, options?: AxiosRequestConfig): Promise<Group> {
const response = await this.superClass.createGroup(groupToCreate, xRequestID, options);
const groupToCreateWithGuard = {
...groupToCreate,
metadata: !groupToCreate?.metadata ? {} : groupToCreate.metadata
}
const response = await this.superClass.createGroup(groupToCreateWithGuard, xRequestID, options);
return response.data;
}

Expand Down
6 changes: 5 additions & 1 deletion src/ext/person-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export class PersonApi {
}

async createPerson(personFields: PersonFields, xRequestID?: string, options?: AxiosRequestConfig): Promise<Person> {
const response = await this.superClass.createPerson(personFields, xRequestID, options);
const personFieldsWithGuard = {
...personFields,
metadata: !personFields?.metadata ? {} : personFields.metadata
}
const response = await this.superClass.createPerson(personFieldsWithGuard, xRequestID, options);
return response.data;
}
async addImageToPerson(
Expand Down

0 comments on commit 670d7f4

Please sign in to comment.