I am trying to pass a string from nodejs backend using res.send
app.post("/user", (req,res) => {
console.log(req.body.email);
res.send('haha');
});
I want to perform some operations based on the retrieved string value on the front end.
axios({
method: 'post',
url: '/user',
data: { email: this.state.emailFetch }
}).then(response => {
if(response.send == "haha")
{
return <Redirect to="/"/>
}
});
I think I'm messing up at the handling of response at the front end. Can anyone guide me though?