alan2207 / react-query-auth

⚛️ Authenticate your react applications easily with react-query.
MIT License
367 stars 43 forks source link

showing a 401 errormessage from the server #6

Closed zouterover closed 1 year ago

zouterover commented 3 years ago

When logging in with wrong login-details I would like to show the 401 error message from the server. How would this be possible? I am also a bit confused as the docs refer to an error that can be derived from the useAuth hook:

  const { user, login, logout, register, error, refetch } = useAuth();

But when I look at the codesandbox example it is not used, but a useState hook on the onSubmit catched error is used. Could you maybe explain how this should work?

alan2207 commented 1 year ago

Check the latest version and the example folder.