I'm trying to redirect the user to the Profile page if the login is successful.
I've tried using the React router redirect as so:
signInWithEmailAndPassword = (username, password) => {
return new Promise((resolve, reject) => {
axios.post(process.env.REACT_APP_BACK_END_DOMAIN + urls.LOGIN, {
username,
password,
},
{
headers: {
'X-CSRFTOKEN': Cookies.get("csrftoken"),
}
}).then(response => {
console.log(response);
if(response.status =='200'){
return <Redirect to='/profile' />
}
});
});
};
But when the login is successful nothing happens.
I don't know what am I doing wrong.