Is there any way I can see an exact query that runs in my app and print it on the log?
For example, I am running this query:
const handleSubmit = React.useCallback(() => { loadUsers({ variables: { where: { firstName: (name.split(""))[0], AND: [{lastName:(name.split(""))[0]}]}, }, }); console.log(print(loadUsers)); }, [loadUsers, name]);
and I want to print and see what are the exact firstName
and ```lastName`` parameters being passed into it. I read about this:
import { print } from 'graphql/language/printer';
and tried to use it like this:
console.log(print(loadUsers));
at the end of my handleSubmit
but when I click on the button to run the query, I get an error saying that
Invalid AST Node
.
How can I print and check my exact query? Could be any other way too - doesn't have to be with graphql printer necessarily.