Found graphql input objects.
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
// 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 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));
|
||||
|
||||
// export const client = new ApolloClient({
|
||||
// link: ApolloLink.from(middlewares),
|
||||
// cache: new InMemoryCache({ addTypename: false }),
|
||||
// typeDefs,
|
||||
// resolvers
|
||||
// });
|
||||
@@ -105,7 +105,7 @@ export const GET_JOB_BY_PK = gql`
|
||||
`;
|
||||
|
||||
export const UPDATE_JOB = gql`
|
||||
mutation UPDATE_JOB($jobId: uuid!, $job: json!) {
|
||||
mutation UPDATE_JOB($jobId: uuid!, $job: jobs_set_input!) {
|
||||
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
||||
returning {
|
||||
id
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { gql } from "apollo-boost";
|
||||
import { GET_CURRENT_USER, GET_WHITE_BOARD_LEFT_SIDER_VISIBLE } from "./local.queries";
|
||||
import {
|
||||
GET_CURRENT_USER,
|
||||
GET_WHITE_BOARD_LEFT_SIDER_VISIBLE
|
||||
} from "./local.queries";
|
||||
|
||||
export const typeDefs = gql`
|
||||
extend type Mutation {
|
||||
SetCurrentUser(user: User!): User!
|
||||
ToggleWhiteBoardLeftSiderVisible: Boolean!
|
||||
}
|
||||
|
||||
extend type User {
|
||||
@@ -12,6 +14,10 @@ export const typeDefs = gql`
|
||||
displayName: String!
|
||||
token: String!
|
||||
}
|
||||
|
||||
extend type Jobs {
|
||||
id: uuid!
|
||||
}
|
||||
`;
|
||||
|
||||
export const resolvers = {
|
||||
@@ -23,20 +29,6 @@ export const resolvers = {
|
||||
});
|
||||
|
||||
return user;
|
||||
},
|
||||
|
||||
toggleWhiteBoardLeftSiderVisible: (_root, _args, { cache }) => {
|
||||
const { whiteBoardLeftSiderVisible } = cache.readQuery({
|
||||
query: GET_WHITE_BOARD_LEFT_SIDER_VISIBLE
|
||||
});
|
||||
|
||||
cache.writeQuery({
|
||||
query: GET_WHITE_BOARD_LEFT_SIDER_VISIBLE,
|
||||
data: { whiteBoardLeftSiderVisible: !whiteBoardLeftSiderVisible }
|
||||
});
|
||||
|
||||
return !whiteBoardLeftSiderVisible;
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user