I'm building a small app with nuxt3 and the Directus module. In my Directus project I have a collection called "Prestations" with a field called "active".
In my app, I want to query all the items from this collection where active === true.
I use this that works well, but it fetches ALL items:
const { getItems } = useDirectusItems();
getItems({ collection: "Prestations"})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err.message)
})
I tried a bunch of variations of things like this:
getItems({ collection: "Prestations",
filter: {
"active": {
"_eq": true
}
}
})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err.message)
})
I don't really understand how to use the global query parameters. I looked in the documentation, but I couldn't find a full example. Only bits and bobs that I try to fit together with no results.
What is the proper way to filter the results of a query?