【发布时间】:2022-07-21 07:06:55
【问题描述】:
我正在使用带有 graphql 的strapi 这是我当前获取所有过滤类别的查询
query GetRecommendedStuff(
$answer1: String!
$answer2: String!
$answer3: String!
) {
tools(
filters: {
and: [
{ categories: { category: { eq: $answer1 } } }
{ categories: { category: { eq: $answer2 } } }
{ categories: { category: { eq: $answer3 } } }
]
}
) {
data {
attributes {
toolname
app_categories {
data {
attributes {
category
}
}
}
}
}
}
}
我想把它变成这样的东西,以便在查询过滤后的数据时过滤器可以是动态的。
query GetRecommendedStuff(
$answers: [Objects]!
) {
tools(
filters: { and: $answers }
) {
data {
attributes {
toolname
app_categories {
data {
attributes {
category
}
}
}
}
}
}
}
这可能吗?
【问题讨论】:
标签: reactjs graphql apollo-client react-apollo strapi