Signin methods working with no errors.

This commit is contained in:
Patrick Fic
2019-12-06 23:42:16 -08:00
parent 4f3d917e06
commit f919025159
4 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { Switch, Route } from "react-router-dom"; import { Switch, Route, Redirect } from "react-router-dom";
import firebase from "../firebase/firebase.utils"; import firebase from "../firebase/firebase.utils";
import "./App.css"; import "./App.css";
@@ -79,18 +79,17 @@ class App extends React.Component {
<Switch> <Switch>
<Route exact path="/" component={LandingPage} /> <Route exact path="/" component={LandingPage} />
<Route exact path="/unauthorized" component={Unauthorized} /> <Route exact path="/unauthorized" component={Unauthorized} />
{/* <Route <Route
exact exact
path="/signin" path="/signin"
render={() => render={() =>
this.props.currentUser.email != null ? ( this.props.currentUser.email != null ? (
<Redirect to="/manage" /> <Redirect to="/manage" />
) : ( ) : (
<SignInContainer /> <SignInPage />
) )
} }
/> */} />
<Route path="/signin" component={SignInPage} />
<PrivateRoute <PrivateRoute
isAuthorized={this.props.currentUser.email != null} isAuthorized={this.props.currentUser.email != null}
path="/manage" path="/manage"

View File

@@ -4,14 +4,13 @@ import { Menu, Icon } from "antd";
import "./header.styles.scss"; import "./header.styles.scss";
import SignOut from "../sign-out/sign-out.component"; import SignOut from "../sign-out/sign-out.component";
export default ({ selectedNavItem, navItems }) => { export default ({ landingHeader, selectedNavItem, navItems }) => {
const handleClick = e => { const handleClick = e => {
console.log("click ", e); console.log("click ", e);
// this.setState({ // this.setState({
// current: e.key // current: e.key
// }); // });
}; };
return ( return (
<Menu <Menu
className="header" className="header"
@@ -27,10 +26,11 @@ export default ({ selectedNavItem, navItems }) => {
</Link> </Link>
</Menu.Item> </Menu.Item>
))} ))}
{!landingHeader ? (
<Menu.Item> <Menu.Item>
<SignOut /> <SignOut />
</Menu.Item> </Menu.Item>
) : null}
</Menu> </Menu>
); );
}; };

View File

@@ -29,6 +29,7 @@ const HeaderContainer = ({ landingHeader }) => {
const parsedNavItems = JSON.parse(data.masterdata_by_pk.value); const parsedNavItems = JSON.parse(data.masterdata_by_pk.value);
return ( return (
<Header <Header
landingHeader={landingHeader}
selectedNavItem={selectedNavItem} selectedNavItem={selectedNavItem}
navItems={parsedNavItems} navItems={parsedNavItems}
/> />

View File

@@ -26,8 +26,14 @@ const authLink = setContext((_, { headers }) => {
} }
}); });
const middlewares = [];
if (process.env.NODE_ENV === "development") {
middlewares.push(apolloLogger);
}
middlewares.push(authLink.concat(httpLink));
export const client = new ApolloClient({ export const client = new ApolloClient({
link: authLink.concat(httpLink), link: ApolloLink.from(middlewares),
cache: new InMemoryCache({ addTypename: false }), cache: new InMemoryCache({ addTypename: false }),
typeDefs, typeDefs,
resolvers resolvers