Skip to content

Commit 39480a5

Browse files
committed
Small code improvements
1 parent 05efb5b commit 39480a5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/controls/peoplepicker/PeoplePickerComponent.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
133133
private async _thisLoadUsers(): Promise<void> {
134134
var stringVal: string = "";
135135

136-
let filtered: boolean = false;
137-
138136
if (this.props.groupName) {
139137
stringVal = `/_api/web/sitegroups/GetByName('${this.props.groupName}')/users`;
140138
} else {
@@ -144,19 +142,17 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
144142
// filter for principal Type
145143
var filterVal: string = "";
146144
if (this.props.principleTypes) {
147-
filterVal = `${"?$filter="}${this.props.principleTypes.map(principalType => `(PrincipalType eq ${principalType})`).join(" or ")}`;
148-
filtered = true;
145+
filterVal = `?$filter=${this.props.principleTypes.map(principalType => `(PrincipalType eq ${principalType})`).join(" or ")}`;
149146
}
150147

151148
// filter for showHiddenInUI
152149
if (this.props.showHiddenInUI) {
153-
filterVal = filtered ? `${filterVal} and (IsHiddenInUI eq ${this.props.showHiddenInUI})` : `?$filter=IsHiddenInUI eq ${this.props.showHiddenInUI}`;
154-
filtered = true;
150+
filterVal = filterVal ? `${filterVal} and (IsHiddenInUI eq ${this.props.showHiddenInUI})` : `?$filter=IsHiddenInUI eq ${this.props.showHiddenInUI}`;
155151
}
156152

157153
const webAbsoluteUrl = this.props.webAbsoluteUrl || this.props.context.pageContext.web.absoluteUrl;
158154
// Create the rest API
159-
const restApi = filtered ? `${webAbsoluteUrl}${stringVal}${filterVal}` : `${webAbsoluteUrl}${stringVal}`;
155+
const restApi = `${webAbsoluteUrl}${stringVal}${filterVal}`;
160156

161157
try {
162158
// Call the API endpoint

0 commit comments

Comments
 (0)