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 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"} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user