Remove custom type definition for now

This commit is contained in:
Ramon Wenger 2022-01-28 22:42:56 +01:00
parent e843f6be6a
commit a3c616d10e
1 changed files with 20 additions and 17 deletions

View File

@ -1,4 +1,4 @@
import {makeVar, defaultDataIdFromObject, InMemoryCache} from '@apollo/client/core'; import {makeVar, InMemoryCache} from '@apollo/client/core';
const showNavigationSidebarVar = makeVar(false); const showNavigationSidebarVar = makeVar(false);
const showProfileSidebarVar = makeVar(false); const showProfileSidebarVar = makeVar(false);
@ -7,6 +7,8 @@ const currentFilterVar = makeVar('');
const helloEmailVar = makeVar(''); const helloEmailVar = makeVar('');
const idToRefFactory = (__typename) => (_, {args, toReference}) => { const idToRefFactory = (__typename) => (_, {args, toReference}) => {
// todo: can we log this via Vue.$log somehow?
console.log(`Trying to reference ${__typename} with id ${args.id}`);
return toReference({ return toReference({
__typename, __typename,
id: args.id id: args.id
@ -55,22 +57,23 @@ const typePolicies = {
objective: {read: idToRefFactory('ObjectiveNode')}, objective: {read: idToRefFactory('ObjectiveNode')},
objectiveGroup: {read: idToRefFactory('ObjectiveGroupNode')}, objectiveGroup: {read: idToRefFactory('ObjectiveGroupNode')},
projectEntry: {read: idToRefFactory('ProjectEntryNode')}, projectEntry: {read: idToRefFactory('ProjectEntryNode')},
project: { // project: {read: idToRefFactory('ProjectNode')},
read(_, {args: {slug, id}, toReference}) { // project: {
console.log(`Trying to reference project with slug ${slug}, id ${id}`); // read(_, {args: {slug, id}, toReference}) {
if (slug) { // console.log(`Trying to reference project with slug ${slug}, id ${id}`);
return toReference({ // if (slug) {
__typename: 'ProjectNode', // return toReference({
slug // __typename: 'ProjectNode',
}); // slug
} else { // });
return toReference({ // } else {
__typename: 'ProjectNode', // return toReference({
id // __typename: 'ProjectNode',
}); // id
} // });
} // }
}, // }
// },
} }
}, },
}; };