Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question : retrieve http status code and headers from useQuery method #374

Open
mokabyls opened this issue Aug 20, 2020 · 3 comments
Open

Comments

@mokabyls
Copy link

Hi,

first of all, many thanks for this awesome library !
I'm facing a problem with React / Redux & Axios Driver. I read many times documentation but i can not find any way to retrieve http status code and headers with getQuery method. The only way i found is to use then method on dispatch.
Maybe i missing something ?

@klis87
Copy link
Owner

klis87 commented Aug 20, 2020

@mokabyls Hi, glad you like it!

Regarding your question, unfortunately for now no, actually this is how it is, some people asked for status code and headers and I added this only to dispatch promise.

I wil try to do it in the future so that this will be also compatible with getQuery. For now this works only for errors, as for successful responses only data is stored in reducer.

There is a way though, you can use onRequest for example to merge response status code or headers with data, so then you will get them with getQuery

@mokabyls
Copy link
Author

@klis87 ,

Cool ! I think it’s very useful for many users with rest api. Meanwhile, i will use the promise on dispatch method.
Again, thanks for your work !

@klis87
Copy link
Owner

klis87 commented Aug 20, 2020

@mokabyls Thx for the good first issue! Btw in the previous message ofc I meant onSuccess, not onRequest

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

No branches or pull requests

2 participants