Found graphql input objects.

This commit is contained in:
Patrick Fic
2019-12-14 13:53:56 -08:00
parent 36e8449383
commit 337048f0e9
8 changed files with 172 additions and 78 deletions

View File

@@ -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;
},
}
}
};