Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Reading Headers With Afterware #373

Closed
NicholasLYang opened this issue Dec 27, 2017 · 4 comments
Closed

Reading Headers With Afterware #373

NicholasLYang opened this issue Dec 27, 2017 · 4 comments
Labels

Comments

@NicholasLYang
Copy link

I'm looking to add afterware that takes the headers from a query and adds them to localstorage. Right now I'm finding a lot of the opposite; middleware taking a token from localstorage and adding it to a query. Anybody have experience with using headers in afterware? Thanks

@agborkowski
Copy link

its solved, you have to update to apollo-link "apollo-link": "^1.0.7", and use code like

https://github.com/benawad/slack-clone-client/blob/31_fix_auto_refresh_of_jwt_tokens/src/apollo.js#L18

but still we have issue with https://github.com/apollographql/apollo-angular/tree/master/packages/apollo-angular-link-http in response i see headers from request only

@ash0080
Copy link

ash0080 commented Jan 14, 2018

@agborkowski
I can get response headers, but
any chance to pass the headers out?
for example to the query response?

I tried, but not work

@evans evans added the question label Feb 15, 2018
@evans
Copy link
Contributor

evans commented Feb 15, 2018

Thank you @agborkowski for the links! (This pun never gets old 😆)

@ash0080 you can add them to the response before returning them from the map call, for example here

@evans evans closed this as completed Feb 15, 2018
@TheCodeDestroyer
Copy link

TheCodeDestroyer commented Jul 17, 2018

@evans I'm quite sure this does not work at least it doesn't in apollo-boost:

you can add them to the response before returning them from the map call, for example here

EDIT: Nevermind I found this apollographql/apollo-client#1419

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants