Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Add support for options in get profiles in and without team (#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander committed Sep 18, 2019
1 parent 9800f16 commit 90de809
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/actions/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,13 @@ export function getProfilesByUsernames(usernames: Array<string>): ActionFunc {
};
}

export function getProfilesInTeam(teamId: string, page: number, perPage: number = General.PROFILE_CHUNK_SIZE, sort: string = ''): ActionFunc {
export function getProfilesInTeam(teamId: string, page: number, perPage: number = General.PROFILE_CHUNK_SIZE, sort: string = '', options: Object = {}): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
const {currentUserId} = getState().entities.users;

let profiles: null;
try {
profiles = await Client4.getProfilesInTeam(teamId, page, perPage, sort);
profiles = await Client4.getProfilesInTeam(teamId, page, perPage, sort, options);
} catch (error) {
forceLogoutIfNecessary(error, dispatch, getState);
dispatch(logError(error));
Expand Down Expand Up @@ -451,11 +451,11 @@ export function getProfilesNotInTeam(teamId: string, groupConstrained: boolean,
};
}

export function getProfilesWithoutTeam(page: number, perPage: number = General.PROFILE_CHUNK_SIZE): ActionFunc {
export function getProfilesWithoutTeam(page: number, perPage: number = General.PROFILE_CHUNK_SIZE, options: Object = {}): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
let profiles = null;
try {
profiles = await Client4.getProfilesWithoutTeam(page, perPage);
profiles = await Client4.getProfilesWithoutTeam(page, perPage, options);
} catch (error) {
forceLogoutIfNecessary(error, dispatch, getState);
dispatch(logError(error));
Expand Down
8 changes: 4 additions & 4 deletions src/client/client4.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,11 @@ export default class Client4 {
);
};

getProfilesInTeam = async (teamId, page = 0, perPage = PER_PAGE_DEFAULT, sort = '') => {
getProfilesInTeam = async (teamId, page = 0, perPage = PER_PAGE_DEFAULT, sort = '', options = {}) => {
this.trackEvent('api', 'api_profiles_get_in_team', {team_id: teamId, sort});

return this.doFetch(
`${this.getUsersRoute()}${buildQueryString({in_team: teamId, page, per_page: perPage, sort})}`,
`${this.getUsersRoute()}${buildQueryString({...options, in_team: teamId, page, per_page: perPage, sort})}`,
{method: 'get'}
);
};
Expand All @@ -628,11 +628,11 @@ export default class Client4 {
);
};

getProfilesWithoutTeam = async (page = 0, perPage = PER_PAGE_DEFAULT) => {
getProfilesWithoutTeam = async (page = 0, perPage = PER_PAGE_DEFAULT, options = {}) => {
this.trackEvent('api', 'api_profiles_get_without_team');

return this.doFetch(
`${this.getUsersRoute()}${buildQueryString({without_team: 1, page, per_page: perPage})}`,
`${this.getUsersRoute()}${buildQueryString({...options, without_team: 1, page, per_page: perPage})}`,
{method: 'get'}
);
};
Expand Down

0 comments on commit 90de809

Please sign in to comment.