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