Merge branch 'release/1.7.0' into rome/1.7.0
This commit is contained in:
@@ -16,6 +16,7 @@ export const QUERY_BODYSHOP = gql`
|
||||
tt_allow_post_to_invoiced
|
||||
md_responsibility_centers
|
||||
tt_enforce_hours_for_tech_console
|
||||
imexshopid
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,41 +1,12 @@
|
||||
//GQL Imports
|
||||
import {
|
||||
ApolloClient,
|
||||
from,
|
||||
HttpLink,
|
||||
InMemoryCache,
|
||||
split,
|
||||
} from "@apollo/client";
|
||||
import { ApolloClient, from, HttpLink, InMemoryCache } from "@apollo/client";
|
||||
import { setContext } from "@apollo/client/link/context";
|
||||
import { onError } from "@apollo/client/link/error";
|
||||
import { RetryLink } from "@apollo/client/link/retry";
|
||||
import { WebSocketLink } from "@apollo/client/link/ws";
|
||||
import { getMainDefinition } from "@apollo/client/utilities";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
import env from "../env";
|
||||
const httpLink = new HttpLink({
|
||||
// uri: "https://bodyshop-dev-db.herokuapp.com/v1/graphql",
|
||||
uri: env.uri,
|
||||
});
|
||||
|
||||
const wsLink = new WebSocketLink({
|
||||
//uri: "wss://bodyshop-dev-db.herokuapp.com/v1/graphql",
|
||||
uri: "wss://db.imex.online/v1/graphql",
|
||||
options: {
|
||||
lazy: true,
|
||||
reconnect: true,
|
||||
connectionParams: async () => {
|
||||
const token =
|
||||
auth.currentUser && (await auth.currentUser.getIdToken(true));
|
||||
if (token) {
|
||||
return {
|
||||
headers: {
|
||||
authorization: token ? `Bearer ${token}` : "",
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
import env from "../env";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
const httpLink = new HttpLink({
|
||||
uri: env.uri,
|
||||
});
|
||||
|
||||
//https://stackoverflow.com/questions/57163454/refreshing-a-token-with-apollo-client-firebase-auth
|
||||
@@ -61,27 +32,27 @@ const subscriptionMiddleware = {
|
||||
next();
|
||||
},
|
||||
};
|
||||
wsLink.subscriptionClient.use([subscriptionMiddleware]);
|
||||
//wsLink.subscriptionClient.use([subscriptionMiddleware]);
|
||||
|
||||
const link = split(
|
||||
// split based on operation type
|
||||
({ query }) => {
|
||||
const definition = getMainDefinition(query);
|
||||
// console.log(
|
||||
// "##Intercepted GQL Transaction : " +
|
||||
// definition.operation +
|
||||
// "|" +
|
||||
// // definition.name.value +
|
||||
// "##"
|
||||
// );
|
||||
return (
|
||||
definition.kind === "OperationDefinition" &&
|
||||
definition.operation === "subscription"
|
||||
);
|
||||
},
|
||||
wsLink,
|
||||
httpLink
|
||||
);
|
||||
// const link = split(
|
||||
// // split based on operation type
|
||||
// ({ query }) => {
|
||||
// const definition = getMainDefinition(query);
|
||||
// // console.log(
|
||||
// // "##Intercepted GQL Transaction : " +
|
||||
// // definition.operation +
|
||||
// // "|" +
|
||||
// // // definition.name.value +
|
||||
// // "##"
|
||||
// // );
|
||||
// return (
|
||||
// definition.kind === "OperationDefinition" &&
|
||||
// definition.operation === "subscription"
|
||||
// );
|
||||
// },
|
||||
// wsLink,
|
||||
// httpLink
|
||||
// );
|
||||
|
||||
const authLink = setContext((_, { headers }) => {
|
||||
return (
|
||||
@@ -113,23 +84,14 @@ const retryLink = new RetryLink({
|
||||
},
|
||||
});
|
||||
|
||||
// const middlewares = [];
|
||||
// if (process.env.NODE_ENV === "development") {
|
||||
// middlewares.push(apolloLogger);
|
||||
// }
|
||||
|
||||
// middlewares.push(retryLink.concat(errorLink.concat(authLink.concat(link))));
|
||||
|
||||
const cache = new InMemoryCache({});
|
||||
|
||||
export const client = new ApolloClient({
|
||||
//link: ApolloLink.from(middlewares),
|
||||
//link: from([apolloLogger, errorLink, authLink, link]),
|
||||
link: from([authLink, link]),
|
||||
link: from([authLink, retryLink, errorLink, httpLink]),
|
||||
cache,
|
||||
notifyOnNetworkStatusChange: true,
|
||||
|
||||
// connectToDevTools: process.env.NODE_ENV !== "production",
|
||||
defaultOptions: {
|
||||
watchQuery: {
|
||||
fetchPolicy: "network-only",
|
||||
|
||||
Reference in New Issue
Block a user