Added auto-redirect if user is already signed in BOD-248

This commit is contained in:
Patrick Fic
2020-08-10 08:54:54 -07:00
parent 4c869ceddf
commit 96d4f0372b
2 changed files with 13 additions and 9 deletions

View File

@@ -1,13 +1,17 @@
import { Layout, Typography } from "antd";
import React from "react";
import ManageSignInButton from "../../components/manage-sign-in-button/manage-sign-in-button.component";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectCurrentUser } from "../../redux/user/user.selectors";
export default function LandingPage() {
return (
<Layout style={{ height: "100vh" }}>
<ManageSignInButton />
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
});
<Typography.Title>ImEX.Online</Typography.Title>
</Layout>
);
export default connect(mapStateToProps, null)(LandingPage);
export function LandingPage({ currentUser }) {
if (currentUser.authorized) return <Redirect to={"/manage"} />;
return <Redirect to={"/signin"} />;
}