Redirect when signed in and going to sign in page.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { Switch, Route } from "react-router";
|
||||
import { Switch, Route, Redirect } from "react-router";
|
||||
import { ApolloProvider } from "react-apollo";
|
||||
import { HttpLink } from "apollo-link-http";
|
||||
import ApolloClient from "apollo-client";
|
||||
@@ -11,11 +11,11 @@ import { gql } from "apollo-boost";
|
||||
import "./App.css";
|
||||
|
||||
//Component Imports
|
||||
import SignIn from "../components/sign-in-form/sign-in-form.component";
|
||||
import LandingPage from "../pages/landing/landing.page";
|
||||
import Manage from "../pages/manage/manage.page";
|
||||
|
||||
import PrivateRoute from "../utils/private-route";
|
||||
import SignInContainer from "../pages/sign-in/sign-in.container";
|
||||
|
||||
const graphqlEndpoint = process.env.REACT_APP_GRAPHQL_ENDPOINT;
|
||||
|
||||
@@ -49,7 +49,13 @@ export default function App({ authState }) {
|
||||
<ApolloProvider client={client}>
|
||||
<Switch>
|
||||
<Route exact path="/" component={LandingPage} />
|
||||
<Route exact path="/signin" component={SignIn} />
|
||||
<Route
|
||||
exact
|
||||
path="/signin"
|
||||
render={() =>
|
||||
authState ? <Redirect to="/manage" /> : <SignInContainer />
|
||||
}
|
||||
/>
|
||||
<PrivateRoute isAuthorized={isIn} path="/manage" component={Manage} />
|
||||
</Switch>
|
||||
</ApolloProvider>
|
||||
|
||||
Reference in New Issue
Block a user