I am using react and its router to make the redirect of my application. When I use a get instruction in my server express it works fine. But when I make a post instruction, it doesn't redirect. What I have to do?. Here is my code:
(I receive the response in the way that I expect, but after that, nothing happens)
lisaApp.post('/signup', (req, res) => {
const validationResult = validateSignupForm(req.body);
if (!validationResult.success) {
return res.status(400).json({
success: false,
message: validationResult.message,
errors: validationResult.errors
});
}
var newClient = req.body
newClient.clientemailname = newClient.userclient
newClient.client_id = uuid.v4()
delete newClient.confirmPassword
ClientApi.saveClient(newClient, function (err, usr) {
if (err) return res.status(500).send(err.message)
console.log('ready to redirect') //Here, the response has a status "0k"
res.redirect('/')
});
});
via maoooricio
No comments:
Post a Comment