BOD-21 Bug fixes for production columns.

This commit is contained in:
Patrick Fic
2020-04-23 10:34:52 -07:00
parent 7544549e10
commit faa93a5e21
12 changed files with 182 additions and 67 deletions

View File

@@ -15,14 +15,14 @@ import { auth } from "../firebase/firebase.utils";
import errorLink from "../graphql/apollo-error-handling";
import App from "./App";
import LogRocket from 'logrocket';
LogRocket.init('gvfvfw/bodyshopapp');
import LogRocket from "logrocket";
LogRocket.init("gvfvfw/bodyshopapp");
export default class AppContainer extends Component {
constructor() {
super();
const httpLink = new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
});
const wsLink = new WebSocketLink({
@@ -36,18 +36,18 @@ export default class AppContainer extends Component {
if (token) {
return {
headers: {
authorization: token ? `Bearer ${token}` : ""
}
authorization: token ? `Bearer ${token}` : "",
},
};
}
}
}
},
},
});
const subscriptionMiddleware = {
applyMiddleware: async (options, next) => {
options.authToken = await auth.currentUser.getIdToken(true);
next();
}
},
};
wsLink.subscriptionClient.use([subscriptionMiddleware]);
@@ -73,13 +73,13 @@ export default class AppContainer extends Component {
);
const authLink = setContext((_, { headers }) => {
return auth.currentUser.getIdToken().then(token => {
return auth.currentUser.getIdToken().then((token) => {
if (token) {
return {
headers: {
...headers,
authorization: token ? `Bearer ${token}` : ""
}
authorization: token ? `Bearer ${token}` : "",
},
};
} else {
return { headers };
@@ -91,12 +91,12 @@ export default class AppContainer extends Component {
delay: {
initial: 300,
max: 5,
jitter: true
jitter: true,
},
attempts: {
max: 5,
retryIf: (error, _operation) => !!error
}
retryIf: (error, _operation) => !!error,
},
});
const middlewares = [];
@@ -110,7 +110,7 @@ export default class AppContainer extends Component {
const client = new ApolloClient({
link: ApolloLink.from(middlewares),
cache,
connectToDevTools: true
connectToDevTools: true,
});
this.state = { client };