1

I have a simple ApolloGateway server, which receives a gql mutation. What I am trying to accomplish is to make another gql mutation upon receiving a success call from the mutation call.

I can see that I can use the method didReceiveResponse in order to handle the received body. However, I am not sure whether there is a better way to do it. Specially, I will need to parse the body, check for the request type, and then make a qgl query, and send an http request, etc.

class SomeRemoteGraphQLDataSource extends RemoteGraphQLDataSource {

    async didReceiveResponse(response, req, context) {
        const body = await super.didReceiveResponse(response, req, context);
        // Do something
        return body;
    }
}
Seeker
  • 75
  • 1
  • 5

0 Answers0