Files
bodyshop/client/src/graphql/resolvers.js
2019-12-16 17:41:07 -08:00

32 lines
551 B
JavaScript

import { gql } from "apollo-boost";
import { GET_CURRENT_USER } from "./local.queries";
export const typeDefs = gql`
extend type Mutation {
SetCurrentUser(user: User!): User!
}
extend type User {
email: String!
displayName: String!
token: String!
}
extend type Jobs {
id: uuid!
}
`;
export const resolvers = {
Mutation: {
setCurrentUser: (_root, { user }, { cache }) => {
cache.writeQuery({
query: GET_CURRENT_USER,
data: { currentUser: user }
});
return user;
}
}
};