Removed a few container pages as we will be using hooks instead. Cleaned up a few debug statements.
This commit is contained in:
@@ -1,40 +1,40 @@
|
||||
import ApolloClient from "apollo-client";
|
||||
import { InMemoryCache } from "apollo-cache-inmemory";
|
||||
import { HttpLink } from "apollo-link-http";
|
||||
import { setContext } from "apollo-link-context";
|
||||
import { resolvers, typeDefs } from "./resolvers";
|
||||
import apolloLogger from "apollo-link-logger";
|
||||
import { ApolloLink } from "apollo-boost";
|
||||
// import ApolloClient from "apollo-client";
|
||||
// import { InMemoryCache } from "apollo-cache-inmemory";
|
||||
// import { HttpLink } from "apollo-link-http";
|
||||
// import { setContext } from "apollo-link-context";
|
||||
// import { resolvers, typeDefs } from "./resolvers";
|
||||
// import apolloLogger from "apollo-link-logger";
|
||||
// import { ApolloLink } from "apollo-boost";
|
||||
|
||||
const httpLink = new HttpLink({
|
||||
uri: process.env.REACT_APP_GRAPHQL_ENDPOINT
|
||||
});
|
||||
// const httpLink = new HttpLink({
|
||||
// uri: process.env.REACT_APP_GRAPHQL_ENDPOINT
|
||||
// });
|
||||
|
||||
const authLink = setContext((_, { headers }) => {
|
||||
// get the authentication token from local storage if it exists
|
||||
const token = localStorage.getItem("token");
|
||||
// return the headers to the context so httpLink can read them
|
||||
if (token) {
|
||||
return {
|
||||
headers: {
|
||||
...headers,
|
||||
authorization: token ? `Bearer ${token}` : ""
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return { headers };
|
||||
}
|
||||
});
|
||||
// const authLink = setContext((_, { headers }) => {
|
||||
// // get the authentication token from local storage if it exists
|
||||
// const token = localStorage.getItem("token");
|
||||
// // return the headers to the context so httpLink can read them
|
||||
// if (token) {
|
||||
// return {
|
||||
// headers: {
|
||||
// ...headers,
|
||||
// authorization: token ? `Bearer ${token}` : ""
|
||||
// }
|
||||
// };
|
||||
// } else {
|
||||
// return { headers };
|
||||
// }
|
||||
// });
|
||||
|
||||
const middlewares = [];
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
middlewares.push(apolloLogger);
|
||||
}
|
||||
middlewares.push(authLink.concat(httpLink));
|
||||
// const middlewares = [];
|
||||
// if (process.env.NODE_ENV === "development") {
|
||||
// middlewares.push(apolloLogger);
|
||||
// }
|
||||
// middlewares.push(authLink.concat(httpLink));
|
||||
|
||||
export const client = new ApolloClient({
|
||||
link: ApolloLink.from(middlewares),
|
||||
cache: new InMemoryCache({ addTypename: false }),
|
||||
typeDefs,
|
||||
resolvers
|
||||
});
|
||||
// export const client = new ApolloClient({
|
||||
// link: ApolloLink.from(middlewares),
|
||||
// cache: new InMemoryCache({ addTypename: false }),
|
||||
// typeDefs,
|
||||
// resolvers
|
||||
// });
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const GET_ALL_OPEN_JOBS = gql`
|
||||
{
|
||||
jobs {
|
||||
id
|
||||
ro_number
|
||||
status
|
||||
scheduled_completion
|
||||
scheduled_delivery
|
||||
vehicle {
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
plate_no
|
||||
{
|
||||
jobs {
|
||||
id
|
||||
est_number
|
||||
ro_number
|
||||
status
|
||||
scheduled_completion
|
||||
scheduled_delivery
|
||||
vehicle {
|
||||
v_model_yr
|
||||
v_make_desc
|
||||
v_model_desc
|
||||
plate_no
|
||||
}
|
||||
owner {
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user