Skip to content

Commit

Permalink
Merge pull request #23 from vedant-jain03/MERN
Browse files Browse the repository at this point in the history
Mern
  • Loading branch information
vedant-jain03 authored Jul 18, 2021
2 parents 7d9cfe6 + 4028698 commit 72a29c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions hash_hub Backend
Submodule hash_hub Backend added at 515e5a
9 changes: 5 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ function App() {
if (localStorage.getItem('user')) {
setuser(JSON.parse(localStorage.getItem('user')));
}
if (localStorage.getItem('userexist')) {
if (localStorage.getItem('userexist')==='true') {
setuserexist(true)
} else{
setuserexist(false);
}
}, [])
}, [localStorage.getItem('user')]);
return (
<>
{
Expand All @@ -64,8 +66,8 @@ function App() {
<span style={{ fontWeight: '600', color: 'white' }}>{user.name}</span>
<button id="login_logout_tackle" onClick={() => {
{
localStorage.setItem('userexist','false')
setuserexist(false)

};
}} style={{ marginLeft: '1rem' }} >Logout</button>
</div> :
Expand Down Expand Up @@ -110,7 +112,6 @@ function App() {
<Route exact path='/' component={Login} />
<Route exact path='/login' component={Login} />
<Route exact path='/register' component={Register} />
<Route exact path='/' component={Login} />
<Route exact path='/Explore' component={Login} />
<Route exact path='/Opensource' component={Login} />
<Route exact path='/ai' component={Login} />
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Forms/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Login() {
setuser(result.user);
setuserexist(true);
localStorage.setItem('user', JSON.stringify(result.user));
localStorage.setItem('userexist', userexist);
localStorage.setItem('userexist', 'true');
history.push('/')
} else {
const result = await res.json();
Expand Down

0 comments on commit 72a29c6

Please sign in to comment.