Getting response from middle end

Howdy folks I’m trying to work on registration and login without getting the headers error. I’m almost there, but I’m stumped. This is the important part of my login on my middle end:

  if (result.length > 0) {
            console.log(result);
            return res.status(200).json({
                data: email
            });
        } else {
            return res.status(401).json({
                    errormessage: "Wrong email or password",
                    status: "fail"
            });
        }

How would I grab the response of the error message for bad login on the front end? This is what I had but it’s not working:

if (response.data.errormessage) {
            this.setState({ errorMessage: response.data.errormessage });
        }

I’m not even sure it’s sending back a response by using the res.status. Any help is appreciated.

How do you get response?

What is the result of logging response?