Skip to content Skip to sidebar Skip to footer

How To Handle Backend Errors In Js Frontend Inside Of Object And With Out Object

i have user login and i have 2 errors handlers email & password empty email & password not match with data base through post man i send empty user name and password r

Solution 1:

Looking at the code of your request handling and the responses I can see that error responses are not consistent in how it handles errors. I think you should think about fixing the response to be consistent. I would try to replace line in error handling of submit

errors : err.response.data.errors,

with something that would create structure for general erros: f.e.

errors : {...err.response.data.errors, general: err.response.data.general}

Post a Comment for "How To Handle Backend Errors In Js Frontend Inside Of Object And With Out Object"