Update cache properties

This commit is contained in:
Ramon Wenger 2022-01-29 21:15:57 +01:00
parent 9cc1ab5324
commit fc24958d9b
5 changed files with 6 additions and 22 deletions

View File

@ -5,6 +5,7 @@ const getOperations = ({readOnly = false, classReadOnly = false}) => ({
ProjectQuery: { ProjectQuery: {
project: { project: {
id: 'projectId', id: 'projectId',
slug: 'project-name',
final: false, final: false,
student: { student: {
id: btoa('PrivateUserNode:1'), id: btoa('PrivateUserNode:1'),

View File

@ -69,23 +69,6 @@ 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: {read: idToRefFactory('ProjectNode')},
project: {
read(_, {args: {slug, id}, toReference}) {
console.log(`Trying to reference project with slug ${slug}, id ${id}`);
if (slug) {
return toReference({
__typename: 'ProjectNode',
id: slug
});
} else {
return toReference({
__typename: 'ProjectNode',
id
});
}
}
},
} }
}, },
}; };

View File

@ -1,7 +1,7 @@
#import "../fragments/projectParts.gql" #import "../fragments/projectParts.gql"
#import "../fragments/projectEntryParts.gql" #import "../fragments/projectEntryParts.gql"
query ProjectQuery($id: ID, $slug: String){ query ProjectQuery($slug: String){
project(slug: $slug, id: $id) { project(slug: $slug) {
...ProjectParts ...ProjectParts
entries { entries {
...ProjectEntryParts ...ProjectEntryParts

View File

@ -43,7 +43,7 @@
</div> </div>
<div class="project__content"> <div class="project__content">
<add-project-entry <add-project-entry
:project="project.id" :project="project.slug"
class="project__add-entry" class="project__add-entry"
data-cy="add-project-entry" data-cy="add-project-entry"
v-if="isOwner && !me.readOnly && !me.selectedClass.readOnly" v-if="isOwner && !me.readOnly && !me.selectedClass.readOnly"
@ -91,7 +91,7 @@
return { return {
project: { project: {
student: { student: {
id: ' ', id: '',
}, },
}, },
me: { me: {

View File

@ -8,7 +8,7 @@ const portfolioRoutes = [
{path: '/portfolio', name: PROJECTS_PAGE, component: portfolio, meta: {hideFooter: true}}, {path: '/portfolio', name: PROJECTS_PAGE, component: portfolio, meta: {hideFooter: true}},
{path: '/portfolio/:slug', name: 'project', component: project, props: true}, {path: '/portfolio/:slug', name: 'project', component: project, props: true},
{path: '/new-project/', name: NEW_PROJECT_PAGE, component: newProject}, {path: '/new-project/', name: NEW_PROJECT_PAGE, component: newProject},
{path: '/edit-project/:id', name: 'edit-project', component: editProject, props: true}, {path: '/edit-project/:slug', name: 'edit-project', component: editProject, props: true},
]; ];
const routes = process.env.VUE_APP_ENABLE_PORTFOLIO ? portfolioRoutes : []; const routes = process.env.VUE_APP_ENABLE_PORTFOLIO ? portfolioRoutes : [];