Привет, я работаю с клиентом graphql в angular.Есть ли способ, как динамически передать имя запроса в качестве переменной?Например,
query ($filterName: String)($names: String)
(filterName: $filterName)(names: $names) {
name
surname
Вот мой текущий код:
this.taxonomyRef = this.apolloTaxonomy.watchQuery<Query>({
query: gql`
query filter($names: String) {
filter(names: $names) {
name
surname
age
address
}
}
`,
variables: { names: this.elements},
fetchResults: false,
fetchPolicy: 'network-only',
});
this.taxonomy = this.taxonomyRef
.valueChanges
.pipe(
map(result => result.data.taxonomy)
);
}