Redirect when signed in and going to sign in page.
This commit is contained in:
13
client/public/logo.svg
Normal file
13
client/public/logo.svg
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="etuajo-oikeus"
|
||||
width="450"
|
||||
height="450">
|
||||
<path d="M 0,225 L 225,0 L 450,225 L 225,450" fill="#000000" />
|
||||
<path d="M 225,431.25 L 18.75,225 L 225,18.75 L 431.25,225" fill="#ffffff" />
|
||||
<path d="M 56.25,225 L 225,56.25 L 393.75,225 L 225,393.75" fill="#000000" />
|
||||
<path d="M 225,386.25 L 63.75,225 L 225,63.75 L 386.25,225" fill="#ffd90f" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 552 B |
BIN
client/public/logo1024.png
Normal file
BIN
client/public/logo1024.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
client/public/logo240.png
Normal file
BIN
client/public/logo240.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
client/public/logo600.png
Normal file
BIN
client/public/logo600.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"short_name": "Bodyshop",
|
||||
"name": "Bodyshop Management System",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -23,7 +23,7 @@ class Header extends Component {
|
||||
{navItems.map(navItem => (
|
||||
<Menu.Item key={navItem.title}>
|
||||
<Link to={navItem.path}>
|
||||
<Icon type={navItem.icontype} />
|
||||
{navItem.icontype ? <Icon type={navItem.icontype} /> : null}
|
||||
{navItem.title}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
|
||||
@@ -27,6 +27,7 @@ const HeaderContainer = ({ landingHeader }) => {
|
||||
if (loading) return <Spin />;
|
||||
if (error) return <Alert message={error.message} />;
|
||||
const parsedNavItems = JSON.parse(data.masterdata_by_pk.value);
|
||||
console.log("::1", landingHeader);
|
||||
return (
|
||||
<Header
|
||||
selectedNavItem={selectedNavItem}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from "react";
|
||||
import HeaderContainer from "../header/header.container";
|
||||
|
||||
export default function ManageShop() {
|
||||
return (
|
||||
<div>
|
||||
|
||||
<HeaderContainer />
|
||||
This is the manage shop component.
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,27 +1,7 @@
|
||||
import React from "react";
|
||||
import { Query } from "react-apollo";
|
||||
import { gql } from "apollo-boost";
|
||||
|
||||
import { Alert } from "antd";
|
||||
import Spin from '../loading-spinner/loading-spinner.component'
|
||||
import ManageShop from "./manage-shop.component";
|
||||
|
||||
const GET_NAV_ITEMS = gql`
|
||||
query nav_items {
|
||||
masterdata_by_pk(key: "NAV_ITEMS") {
|
||||
value
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const ManageShopContainer = () => (
|
||||
<Query query={GET_NAV_ITEMS}>
|
||||
{({ loading, error, data }) => {
|
||||
if (loading) return <Spin />;
|
||||
if (error) return <Alert message={error.message} />;
|
||||
return <ManageShop />;
|
||||
}}
|
||||
</Query>
|
||||
);
|
||||
const ManageShopContainer = () => <ManageShop />;
|
||||
|
||||
export default ManageShopContainer;
|
||||
|
||||
@@ -23,7 +23,10 @@ export const GET_SELECTED_NAV_ITEM = gql`
|
||||
|
||||
export const GET_CURRENT_USER = gql`
|
||||
query GetCurrentUser {
|
||||
currentUser @client
|
||||
currentUser @client {
|
||||
email
|
||||
displayName
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
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