how to use "Global Query Parameters" #20
-
How to use the Global Query Parameters, like limit, filter, fields.
my params object is defined in a const, but it doesn't seams to work.
note: i pass the parameters, id and collection to the function and i check if they ware OK with some old console log. any suggestion? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Also i think that the deep query parameter is not supported. nuxt-directus/src/runtime/types/index.d.ts Lines 42 to 50 in ca57dbd |
Beta Was this translation helpful? Give feedback.
-
Hello @Intevel, EDIT: Sorry cache error forgot to set the env to not cache in dev environment, now it all works I try with various options: const parameters = {
fields: [
"*",
"invoices.number",
"invoices.id",
"invoices.object",
"invoices.status",
"subscriptions.id",
"subscriptions.status",
"subscriptions.metadata_title",
],
deep: '{"invoices":{"_limit":3,"_sort":"-created"},"subscriptions":{"_limit":3}}',
}; This first option also has an interesting error shown by VScode, it says that deep doesn't accept a string. or deep as an object and not as a string, doesn't work. const parameters = {
fields: [
"*",
"invoices.number",
"invoices.id",
"invoices.object",
"invoices.status",
"subscriptions.id",
"subscriptions.status",
"subscriptions.metadata_title",
],
deep: {
invoices: { _limit: 3, _sort: "-created" },
subscriptions: { _limit: 3 },
},
}; |
Beta Was this translation helpful? Give feedback.
Also i think that the deep query parameter is not supported.
https://docs.directus.io/reference/query/#deep
nuxt-directus/src/runtime/types/index.d.ts
Lines 42 to 50 in ca57dbd