Say I have two GraphQL queries.
Query A:
{
entry(section: [privacyStatement]) {
... on PrivacyStatement {
title
slug
pageTitle
metaDescription
metaImage {
id
title
url
}
}
}
}
Query B:
{
entry(section: [contact]) {
... on Contact {
title
slug
pageTitle
metaDescription
metaImage {
id
title
url
}
}
}
}
Now I want both queries to contain another query:
Query C:
{
services: categories(groupId: 1, level: 1) {
id
title
slug
children {
id
title
slug
}
}
}
How do I do that without duplicating query C in both query A and B (which would not be very DRY)? You can only use fragments for pieces within one query if I understand correctly.
Update:
So I mean something like this:
Query A {
entry(section: [privacyStatement]) {
... on PrivacyStatement {
title
slug
pageTitle
metaDescription
metaImage {
id
title
url
}
}
}
}
QueryC
and:
Query B {
entry(section: [contact]) {
... on Contact {
title
slug
pageTitle
metaDescription
metaImage {
id
title
url
}
}
}
}
QueryC