I work on react-native app with Strapi bakend.
Somebody cant help me with , Graphql query . This simple query give me all bookings:
query GetMyBookings {
bookings {
data
{
id
attributes {
name
date
price
}
}
}
}.
But i want to fetch only my booking (authenticated user) , and sort by date.
I AM a beginner with Graphql, and I still can’t do complex queries. I can’t find any suitable literature either.
I try this:
query GetMyBookings($userId: ID!) {
bookings(filters: { user: { id: { eq: $userId } } }, sort: ["date:asc"]) {
data
{
id
attributes {
name
date
price
}
}
}
}
but trow me error:
“message”: “Variable “$userId” of required type “ID!” was not provided.”,