Skip to content

Commit

Permalink
login redirect is working
Browse files Browse the repository at this point in the history
  • Loading branch information
VanceMcGrady committed Aug 18, 2022
1 parent d35dc97 commit 711f9a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/components/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const Login = (props) => {
setIsSubmitted(res.data.loggedIn)
setWhoLogged(res.data.user.username);
props.setUser(res.data.user.username);

res.data.loggedIn ? window.location.href = 'http://localhost:8080/' : (console.log('login failed'))
});
}

Expand All @@ -52,7 +54,9 @@ const Login = (props) => {

return(
<div className="login-div">
{isSubmitted ? <div className="login-success"><h3>Successfully logged in!</h3><h3>Welcome {userProfile}!</h3><Link to='/' id="enter-link">Click Here</Link></div> : renderForm}
{isSubmitted ?
<div className="login-success"><h3>Welcome {whoLogged}! </h3><h4>We're fetching your data</h4></div>
: renderForm}
</div>
)
}
Expand Down

0 comments on commit 711f9a6

Please sign in to comment.