Added auto-redirect if user is already signed in BOD-248
This commit is contained in:
@@ -1,13 +1,17 @@
|
|||||||
import { Layout, Typography } from "antd";
|
|
||||||
import React from "react";
|
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() {
|
const mapStateToProps = createStructuredSelector({
|
||||||
return (
|
currentUser: selectCurrentUser,
|
||||||
<Layout style={{ height: "100vh" }}>
|
});
|
||||||
<ManageSignInButton />
|
|
||||||
|
|
||||||
<Typography.Title>ImEX.Online</Typography.Title>
|
export default connect(mapStateToProps, null)(LandingPage);
|
||||||
</Layout>
|
|
||||||
);
|
export function LandingPage({ currentUser }) {
|
||||||
|
if (currentUser.authorized) return <Redirect to={"/manage"} />;
|
||||||
|
|
||||||
|
return <Redirect to={"/signin"} />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user