Fixed selected nav item. Added lazy loading for WS client to resolve token issue. Added some filtering to jobs list.

This commit is contained in:
Patrick Fic
2019-12-12 12:23:31 -08:00
parent f6c62da40a
commit bca375251e
9 changed files with 266 additions and 42 deletions

View File

@@ -13,20 +13,17 @@ import SignInPage from "../pages/sign-in/sign-in.page";
import Unauthorized from "../pages/unauthorized/unauthorized.component";
import { auth } from "../firebase/firebase.utils";
import { UPSERT_USER } from "../graphql/user.queries";
import { GET_CURRENT_USER } from "../graphql/local.queries";
import LoadingSpinner from "../components/loading-spinner/loading-spinner.component";
import AlertComponent from "../components/alert/alert.component";
import SignOut from "../components/sign-out/sign-out.component";
import { UPSERT_USER } from "../graphql/user.queries";
export default () => {
const apolloClient = useApolloClient();
useEffect(() => {
//Run the auth code only on the first render.
const unsubscribeFromAuth = auth.onAuthStateChanged(async user => {
const unsubscribeFromAuth = auth.onIdTokenChanged(async user => {
if (user) {
let token;
token = await user.getIdToken();
@@ -85,7 +82,6 @@ export default () => {
return <AlertComponent message={HookCurrentUser.error.message} />;
return (
<div>
<SignOut />
<Switch>
<Route exact path="/" component={LandingPage} />
<Route exact path="/unauthorized" component={Unauthorized} />