plugin-graphql icon indicating copy to clipboard operation
plugin-graphql copied to clipboard

Help needed: hook for http response headers (401)

Open adminfriso opened this issue 6 years ago • 3 comments

I get a response of 401 if I am not authenticated in my graphql api.

Is there a way to centralised catch all errors from apollo and do something with it on 1 place.

adminfriso avatar Dec 13 '18 13:12 adminfriso

Currently not. I'm open for suggestions and Pull Requests :)

phortx avatar Dec 13 '18 13:12 phortx

@phortx thanks for your fast reply. Could you maybe help me with another question. Is there a way to update the options of VuexORM after you do this line VuexORM.use(VuexORMGraphQL, {options});

adminfriso avatar Dec 13 '18 14:12 adminfriso

Nope. For dynamic behavior there would be a function. Like we're doing it with HTTP Headers.

I suggest something like this:

VuexORM.use(VuexORMGraphQL, {
  database: database,
  ...,
  onError(error) {
    // handle error here
  }
});

phortx avatar Dec 13 '18 15:12 phortx