import { connect } from "react-redux";
import Header from "./components/header/Header";
import App from "./App"
import Login from "./components/session/Login";

const Root = ({ isLoggedIn }) => {
  return (
    <div>
      <Header />
      {isLoggedIn ? 
        <App /> :
        <Login />
      }
    </div>
  );
}

const mapStateToProps = (state) => ({
  isLoggedIn: state.session.isAuthenticated,
});

const mapDispatchToProps = (dispatch) => ({

});

export default connect(mapStateToProps, mapDispatchToProps)(Root);