-1

I'm currently on client side trying to make a query but can't go through. However it works when testing at the back-end.

const QUERY_SPECIFIC_CATEGORY_PRODUCTS = gql` query QUERY_SPECIFIC_CATEGORY_PRODUCTS($category: String!) { category(input: { title: $category }) { name } } `; const { data, loading, error } = useQuery(QUERY_SPECIFIC_CATEGORY_PRODUCTS, { // prettier-ignore variables: {input: { title: "clothes" }} });

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Al1
  • 308
  • 3
  • 9

1 Answers1

0

When you call useQuery just pass the "clothes" value as the category variable:

const { data, loading, error } = useQuery(QUERY_SPECIFIC_CATEGORY_PRODUCTS, {
  variables: { category: "clothes" },
});
tromgy
  • 4,937
  • 3
  • 17
  • 18