I think this could be a pretty simple fix, the server says more specifically what the errors are in the form of a message, but it can send the front like a made up error code if that'd simplify things.
In register specifically this is what it looks like now:
case 1: the username was already in the database
res.status(401).json({message:'username already in use'})
case 2: it worked
res.status(201).json({message:'success'})
case 3: api call was made with insufficient information (one of the fields was missing)
res.status(401).json({message:'incomplete registration information'})
If you want I can add a second property to the error objects and we can use made up error codes, or I could write more verbose error messages and you could use what the message says for the pop up errors
I think this could be a pretty simple fix, the server says more specifically what the errors are in the form of a message, but it can send the front like a made up error code if that'd simplify things.
In register specifically this is what it looks like now: case 1: the username was already in the database res.status(401).json({message:'username already in use'}) case 2: it worked res.status(201).json({message:'success'}) case 3: api call was made with insufficient information (one of the fields was missing) res.status(401).json({message:'incomplete registration information'})
If you want I can add a second property to the error objects and we can use made up error codes, or I could write more verbose error messages and you could use what the message says for the pop up errors