Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added search param to get user profiles function #52

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/modes/rest/resources/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type NewUser = {
type GetUserProfilesParams = {
pageSize: number
page: number
searchQuery?: string
}

type GetUserProfilesResponseData = {
Expand Down Expand Up @@ -129,7 +130,7 @@ export class UserResource implements IRestResource {
}
async getUserProfiles(params: GetUserProfilesParams): Promise<GetUserProfilesResponseData> {
return await fetchGet<GetUserProfilesResponse>(
`${this.client.apiBaseUrl}/users?page_size=${params.pageSize}&page=${params.page - 1}`,
`${this.client.apiBaseUrl}/users?page_size=${params.pageSize}&page=${params.page - 1}${params.searchQuery ? "&search=" + params.searchQuery : ""}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mario-nt isn't the param name searchQuery wrong?

In the Index PR I've just merged the param name is search https://github.com/torrust/torrust-index/blob/develop/src/services/torrent.rs#L65?

{
"Authorization": `Bearer ${this.client.authToken}`,
"Content-Type": "application/json"
Expand Down
Loading