Strange issue with useQuery: Query arguments not being read

前端 未结 1 588
星月不相逢
星月不相逢 2021-01-18 13:58

I have a component that passes a string (userToFetch) it as a variable parameter in a parameterized query. The component looks like this:

// pag         


        
相关标签:
1条回答
  • 2021-01-18 14:43

    The schema generated by Strapi gives the where attribute a Type JSON and hence you have to pass the entire where part in the query variable as JSON since the variables are not getting injected.

    # Write your query or mutation here
    query users($where: JSON) {
      users(where: $where) {
        username
        firstName
      }
    }
    

    And the variables would look like:

    {"where": {"username": "jonsnow"}}
    
    0 讨论(0)
提交回复
热议问题