I have been attempting to Redirect upon user login. The login works correctly with my database and will conditionally render my new links for my admin portal. I was trying to use Redirect upon getting a status code 200, but I am not sure if this is even the correct way.
axios post for Login component:
const handleSubmit = e => {
e.preventDefault();
console.log(adminLogin)
axios
.post("/api/Authentication", adminLogin)
.then(function(response) {
if (response.status === 200) {
setIsLoggedIn(true);
<Redirect to="/inventory" />
}
setAdminLogin(response.data);
console.log(response);
})
.catch(function(error) {
console.log(error);
});