Redirect when signed in and going to sign in page.
This commit is contained in:
25
client/src/pages/sign-in/sign-in.container.jsx
Normal file
25
client/src/pages/sign-in/sign-in.container.jsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import { Query } from "react-apollo";
|
||||
|
||||
import { Alert } from "antd";
|
||||
|
||||
import Spin from "../../components/loading-spinner/loading-spinner.component";
|
||||
// import Skeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
|
||||
import { GET_CURRENT_USER } from "../../graphql/metadata.queries";
|
||||
import SignInPage from "./sign-in.page";
|
||||
|
||||
const SignInContainer = () => {
|
||||
return (
|
||||
<Query query={GET_CURRENT_USER}>
|
||||
{({ loading, error, data: { currentUser } }) => {
|
||||
if (loading) return <Spin />;
|
||||
if (error) return <Alert message={error.message} />;
|
||||
|
||||
return <SignInPage signedIn={currentUser.email ? true : false} />;
|
||||
}}
|
||||
</Query>
|
||||
);
|
||||
};
|
||||
|
||||
export default SignInContainer;
|
||||
@@ -1,13 +1,14 @@
|
||||
import React from "react";
|
||||
import signInComponent from "../../components/sign-in-form/sign-in-form.component";
|
||||
import SignInComponent from "../../components/sign-in-form/sign-in-form.component";
|
||||
|
||||
import { Redirect } from "react-router-dom";
|
||||
|
||||
|
||||
export default function SignInPage() {
|
||||
export default ({signedIn}) => {
|
||||
console.log(signedIn)
|
||||
return (
|
||||
<div>
|
||||
<signInComponent />
|
||||
<SignInComponent />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user