Replies: 1 comment
-
I answer because i lost a few hours to figure this out. query getAuthors($order_by: [authors_order_by!] = {}, $limit: Int = 10, $offset: Int = 10) {
authors(order_by: $order_by, limit: $limit, offset: $offset) {
id
name
books
}
} import { Order_By, type Authors_Order_By } from '@/.nuxt/gql/default'
const orderBy = computed<Authors_Order_By>( () => {
// Do something to calculate your order Object
return {
name: Order_By.Desc
}
})
const { data, pending } = await useAsyncGql({
operation: 'indexAuthors',
variables: { order_by: orderBy }
}) I hope this helps if you wonder how to order ;) Cheers |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Can somebody please help me with this case?
How can I pass object to a query, to define whole key/value of the field, not only value.
Here is my query:
object
would be dynamically set at runtime. Here are possible ordering objects I have in mind{ date_published: "ASC" }
or
{ price: "DESC" }
or
{ name: "ASC" }
and so on...
Somehow I find this difficult, getting syntax errors all the time.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions