-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
How to get error message #377
Comments
@christian-hess-94 Try to inspect error.data, do you see anything there? If not, we will need to extend fetch driver to allow error messages other than json. |
@klis87 Thanks for replying will check it right now and get back to you |
@christian-hess-94 no problem. Btw, this is the problematic line - https://github.com/klis87/redux-requests/blob/master/packages/redux-requests-fetch/src/fetch-api-driver.js#L44 I assumed error response will use always JSON, but that might be too simplified approach. As a last resort, we will introduce new attr like |
Well, when callind error.json() the error is the same but it reads as |
I'm assuming this means that the json() command was executed before, but when running something like JSON.stringify(error) it returns an empty object |
So we need this |
I'm still trying to grasp it all,just started using the package today. Maybe some day in the future or during a weekend (currently having a lot of work, i'm renovting the entire ecosystem of my company [practically alone!]) I'm using React and I noticed you have added a couple of facilitators for it. Does the package support the usage of hooks? |
Problem is i'm at home right now and am not able to connect to the company's VPN (for w/e reason) so i'm unable to fire the requests. I think i'm only gonna be able to check in on this properly on Tuesday |
Ok, no problem, maybe I will have some time before. Alternatively you could try axios driver, actually syntax is quite similar and with using this library it doesnt really matter you use axios or fetch. Regarding React, yes, hooks are supported, for example https://redux-requests.klisiczynski.com/docs/guides/usage-with-react#usequery |
I have a java rest api (it's old) and currently it send some text messages based on the authentication status of the information sent in the request.
When using pure fetch (with sagas) I manage to retrieve this message by running await error.text() (inside a catch(error))
However, when using redux-request with the fetch-driver, I get an error as follows:
This is the code:
When clicking a button, execute this function:
This is my "login" action:
The request is fired just fine. Again, If I input a correct combination of "user" and "password" I get the data back just fine. I just need to know how to get the error messages back.
Also, in my Redux DevTools, the LOGIN, LOGIN_SUCCESS and LOGIN_FAILED actions are fired just fine.
The text was updated successfully, but these errors were encountered: