Skip to content
Open
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion src/endpoints/study/recruitment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,28 @@ class Recruitment extends Endpoint {
offset,
search,
response_as_dto,
is_descending,
order_by,
}: {
studyId: string;
limit?: number | null;
offset?: number | null;
search?: string | null;
response_as_dto?: boolean | null;
is_descending?: boolean | null;
order_by?: "Username" | "Email" | null;
}) {
const response = await this.actions.get<
ParticipantAccount[] | PaginatedParticipantAccounts
>(`${this.wsEndpoint}/${studyId}/participants/accounts`, {
params: { limit, offset, search, response_as_dto },
params: {
limit,
offset,
search,
response_as_dto,
is_descending,
order_by,
},
Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

Consider filtering out null or undefined values before sending the params object so that unwanted query strings (e.g., is_descending=null) are not included in the request URL.

Suggested change
params: {
limit,
offset,
search,
response_as_dto,
is_descending,
order_by,
},
params: Object.fromEntries(
Object.entries({
limit,
offset,
search,
response_as_dto,
is_descending,
order_by,
}).filter(([_, value]) => value != null),
),

Copilot uses AI. Check for mistakes.
});

return response.data;
Expand Down
Loading