27 lines
925 B
JavaScript
27 lines
925 B
JavaScript
import SCROLL_POSITION from '@/graphql/gql/local/scrollPosition.gql';
|
|
import HELLO_EMAIL from '@/graphql/gql/local/helloEmail.gql';
|
|
import SIDEBAR from '@/graphql/gql/local/sidebar.gql';
|
|
|
|
export const resolvers = {
|
|
Mutation: {
|
|
scrollTo: (_, {scrollTo}, {cache}) => {
|
|
const data = cache.readQuery({query: SCROLL_POSITION});
|
|
data.scrollPosition.scrollTo = scrollTo;
|
|
cache.writeQuery({query: SCROLL_POSITION, data});
|
|
return data.scrollPosition;
|
|
},
|
|
helloEmail: (_, {email}, {cache}) => {
|
|
const data = cache.readQuery({query: HELLO_EMAIL});
|
|
data.helloEmail.email = email;
|
|
cache.writeQuery({query: HELLO_EMAIL, data});
|
|
return data.helloEmail;
|
|
},
|
|
toggleSidebar: (_, {open}, {cache}) => {
|
|
const data = cache.readQuery({query: SIDEBAR});
|
|
data.sidebar.open = open;
|
|
cache.writeQuery({query: SIDEBAR, data});
|
|
return data.sidebar;
|
|
}
|
|
}
|
|
};
|