re: react-apollo: An approach to handle errors globally VIEW POST

re: Hm, can you explain your situation a little bit more? How does the response from your GraphQL look like? Is it stated as an error?

If I first use this code:

applyAfterware({ response }, next) {

I have this:

Response {type: "cors", url: "localhost:8080/api", redirected: false, status: 200, ok: true, …}
body: ReadableStream
bodyUsed: true
headers: Headers
ok: true
redirected: false
status: 200
statusText: "OK"
type: "cors"
url: "localhost:8080/api"
proto: Response

I can't read body.

So I found this:

and now I'm using:

const handleErrors = ({ response }, next) => {
// clone response so we can turn it into json independently
const res = response.clone()

And now I can use res.

But what I don't knowis why .clone()? Because response is a response?

After all I need to destroy res? How?

code of conduct - report abuse