mobilizon/js/src/apollo/user.ts

28 lines
501 B
TypeScript
Raw Normal View History

2019-01-18 14:47:10 +01:00
export const currentUser = {
defaults: {
currentUser: {
__typename: 'CurrentUser',
id: null,
email: null,
isLoggedIn: false,
2019-01-18 14:47:10 +01:00
},
},
resolvers: {
Mutation: {
updateCurrentUser: (_, { id, email, isLoggedIn }, { cache }) => {
2019-01-18 14:47:10 +01:00
const data = {
currentUser: {
id,
email,
isLoggedIn,
2019-01-18 14:47:10 +01:00
__typename: 'CurrentUser',
},
};
cache.writeData({ data });
},
},
},
};