import React from "react";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectCurrentUser } from "../../redux/user/user.selectors";
import LandingPageStatic from "../../landing/index";

const mapStateToProps = createStructuredSelector({
  currentUser: selectCurrentUser,
});

export default connect(mapStateToProps, null)(LandingPage);

export function LandingPage({ currentUser }) {
  if (currentUser.authorized) return <Redirect to={"/manage"} />;

  return <LandingPageStatic />;
  //return <Redirect to={"/signin"} />;
}
