I am using Hasura for GraphQL on server. I am trying to run this query
query MyQuery {
user_attribute_values(where: {id: {_eq: 3}}) {
id
attribute_id
user_id
value
user_attribute {
enum_attribute_type {
value
}
}
}
}
which should return me something like this
{
"data": {
"user_attribute_values": [
{
"id": 3,
"attribute_id": 3,
"user_id": 2,
"value": "true",
"user_attribute": {
"enum_attribute_type": {
"value": "boolean"
}
}
}
]
}
}
but it's returning me
{
value: "true"
updated_at: "2020-04-16T07:23:04.568105+00:00"
deleted_at: null
created_at: "2020-04-16T07:23:04.568105+00:00"
id: 3
user_id: 2
attribute_id: 3
}
So apparently it's just ignoring the inner part and just returning me one level of data.
This is the way I am trying to do it
const client = new ApolloClient({
uri: process.env.REACT_APP_HASURA_GRAPHQL_URL,
});
<ApolloProvider client={client}>
... all my remaining code
</ApolloProvider>
const USER_ATTRIBUTES_QUERY = gql`
{
user_attribute_values(where: { id: { _eq: 3 } }) {
id
attribute_id
user_id
value
user_attribute {
enum_attribute_type {
value
}
}
}
}
`;
const { loading, error, data } = useQuery(USER_ATTRIBUTES_QUERY);
It's very straight forward simple code but doesn't seem to be working.