import { selectCurrentUser } from "@/redux/user/user.selectors";
import { Redirect } from "expo-router";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";

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

function Index({ currentUser }) {
  if (currentUser.authorized) {
    return <Redirect href="/" />;
  }

  return <Redirect href="/sign-in" />;
}
export default connect(mapStateToProps, null)(Index);
