Type useMutation error #4978
Unanswered
fellipe-vidal
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It's a simple use case. I need to show the reason a form failed to the user. For example, when the user submits the login form, I need to show a message that the user username or password is invalid when I get a 401 error and another one when I receive a 422 error or a 500 error.
The code below is working
But I get a squiggly line under error.response. Since error is type unknown, VS Code show "Property 'response' does not exist on type '{}'."
Is there a way for me to type the error property? I'm using axios as the client, so every failed HTTP request should be of type AxiosError.
Beta Was this translation helpful? Give feedback.
All reactions