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:
@@ -30,6 +30,7 @@ class AppContainer extends Component {
|
||||
const wsLink = new WebSocketLink({
|
||||
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT_WS,
|
||||
options: {
|
||||
lazy: true,
|
||||
reconnect: true,
|
||||
connectionParams: () => {
|
||||
const token = localStorage.getItem("token");
|
||||
@@ -49,7 +50,11 @@ class AppContainer extends Component {
|
||||
({ query }) => {
|
||||
const definition = getMainDefinition(query);
|
||||
console.log(
|
||||
"##Intercepted GQL Transaction##" + definition.operation,
|
||||
"##Intercepted GQL Transaction : " +
|
||||
definition.operation +
|
||||
"|" +
|
||||
definition.name.value +
|
||||
"##",
|
||||
query
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user