aleena reji
aleena reji

Reputation: 119

React admin Filter query inside useGetList

enter image description here

I want to filter the response with selected project_id. For that I have implemented a filter in

  const { data } = useGetList("project_skill_requirement", {
    project_id: projectId,
  });

where projectId is selected project id ("5b99808c-6059-4bfa-96ac-2fa74c66af31").

so that I will get the response of selected project.But instead of that it showing all the project list shown in the picture.

Thanks in advance.

Upvotes: 0

Views: 1305

Answers (1)

Striped
Striped

Reputation: 2547

If you want to filter you response, apply the filter on the data you received like

const { data } = useGetList("project_skill_requirement");
const projects = data.filter(({project_id}) => project_id === projectId); 

If you want to filter on request, your payload seems good, look at the network request to see if your filter is properly applied.

Upvotes: 1

Related Questions