Skip to content

Filter using FrontQL

Introduction

In web applications, filtering data based on specific values is a common requirement. FrontQL allows you to filter data using the filter query parameter.

Implementing Filter

  • Use the filter query parameter to specify the criteria.
  • If filter changes, the token has to be regenerated.
  • It is passed to the headers of the request.

Example

Here’s a simple example of implementing filter using FrontQL:

async function getUsers() {
const response = await Api.get("/users", {
filter: "name:John",
});
return response;
}

In this example, the filter query parameter is used to specify that the users collection should be filtered by the name field. The filter is done on the name field in the users collection.