A returned schema looks like the following:
{
data: {
posts: {
edges: [
{
post: {
id: ‘1’,
title: ‘Foo’
},
post: {
id: ‘2’,
title: ‘Bar’
}
}
]
}
}
}
This works and I can use it, but I’m having to create nested interfaces unfortunately.
Question: Can I either simplify the returned results OR transform them with JavaScript map()
?
Ideally, I’d like for the GQL response (or resulting object) to be like:
{
data: {
posts: [
post: {
id: ‘1’,
title: ‘Foo’
},
post: {
id: ‘2’,
title: ‘Bar’
}
]
}
}
Note: I do not have the ability to update the server-side GraphQL schema. The solution must be client/consumer side.
Thanks!