Skip to content
Snippets Groups Projects
Commit 41ae71cc authored by Ismail's avatar Ismail
Browse files

fixied some errors in login and logout functions! Done

parent d41c6de1
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ class Signin extends Component {
const mapStateToProps = (state) => {
return {
authError: state.authError,
authError: state.auth.authError,
auth: state.firebase.auth
}
}
......
......@@ -2,12 +2,18 @@ import React, { Component } from 'react'
import Navbar from '../layout/Navbar';
import ManageShift from '../layout/ManageShift';
import ShiftReport from '../layout/ShiftReport';
import { connect } from 'react-redux';
import { firestoreConnect } from 'react-redux-firebase';
import { compose } from 'redux';
import { Redirect } from 'react-router-dom';
class Dashboard extends Component {
render() {
const { profile, auth } = this.props;
if( !auth.uid ) return <Redirect to='/signin' />
return (
<div id="content">
<Navbar />
<Navbar profile={ profile } />
<ManageShift />
<ShiftReport />
</div>
......@@ -15,4 +21,11 @@ class Dashboard extends Component {
}
}
export default Dashboard
const mapStateToProps = (state) => {
return{
auth: state.firebase.auth,
profile: state.firebase.profile
}
}
export default connect(mapStateToProps,null)(Dashboard)
......@@ -7,7 +7,7 @@ const Navbar = (props) => {
<nav className="navbar navbar-expand-lg navbar-light bg-primary">
<div className="container">
<h5>Employee Management</h5>
<h5 className="text-center">Welcome </h5>
<h5 className="text-center">Welcome { props.profile.firstName} { props.profile.lastName }</h5>
<button type="button" onClick={ props.signOut } className="btn btn-success btn-sm float-right btn-logout">Logout</button>
</div>
</nav>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment