From 7b4d95262709736b0de027a349800f60a2a16150 Mon Sep 17 00:00:00 2001 From: Ismail <msiamil.official@gmail.com> Date: Wed, 19 Aug 2020 23:11:46 +0500 Subject: [PATCH] Nav link modified. session thing updated for loggedIn users! --- employeemanagement/src/App.js | 7 +++++-- employeemanagement/src/components/auth/SignIn.js | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/employeemanagement/src/App.js b/employeemanagement/src/App.js index 9b3cf49..6975af4 100644 --- a/employeemanagement/src/App.js +++ b/employeemanagement/src/App.js @@ -1,13 +1,16 @@ import React from 'react'; import SignIn from './components/auth/SignIn' import Dashboard from './components/dashboard/Dashboard' -import { BrowserRouter } from 'react-router-dom'; +import { BrowserRouter, Switch, Route } from 'react-router-dom'; function App() { return ( <BrowserRouter> <div className="App"> - <SignIn /> + <Switch> + <Route exact path='/' component={Dashboard} /> + <Route path='/signin' component={SignIn} /> + </Switch> </div> </BrowserRouter> ); diff --git a/employeemanagement/src/components/auth/SignIn.js b/employeemanagement/src/components/auth/SignIn.js index 770701a..e7c085b 100644 --- a/employeemanagement/src/components/auth/SignIn.js +++ b/employeemanagement/src/components/auth/SignIn.js @@ -21,7 +21,8 @@ class Signin extends Component { this.props.signIn(this.state); } render(){ - const { authError } = this.props; + const { authError, auth } = this.props; + if( auth.uid ) return <Redirect to='/' /> return( <div className="Login"> <div className="login-wrap"> @@ -49,9 +50,9 @@ class Signin extends Component { } const mapStateToProps = (state) => { - //console.log(state.authError); return { authError: state.authError, + auth: state.firebase.auth } } -- GitLab