I have to do a query and I have to pass a nested variable. Below is the working query when I use apollo graphql client interface. It is giving me expected result. Below is the working query
query($input: MyProductInput!){
MyProductCategories(input: $input){
id,
name
}
}
Variable which i am passing
{
"input": {
"locale": "ENG"
}
}
MyProductInput type look like this at SERVER
type MyProductInput {
locale: Locale!
}
enum Locale {
IND
AUS
ENG
}
when I try to call the same query from my React App, it is giving me error, It says 400 bad request. My React query look like this.
const PRODUCT_LIST = gql`
query ($locale: String!) {
MyProductCategories(input: {locale: $locale}){
id,
name
}
}
`;
const { loading, error, data } = useQuery(PRODUCT_LIST, {
variables: {
"input": {
"locale": "ENG"
}
},
});
How can i convert my react query to accommodate custom types??
Note: I am using JavaScipt not Typescript at Front-end side
its working fine in apollo graphql client interface- Raj Rjid, name- Nisharg Shah