Fix new room entry page for default case

This commit is contained in:
Ramon Wenger 2023-02-23 20:11:35 +01:00
parent 6e0c158330
commit b5b4b2aa70
1 changed files with 7 additions and 5 deletions

View File

@ -59,10 +59,12 @@ export default defineComponent({
},
save({ title, contents }) {
const entry = {
...{
title,
contents,
roomSlug: this.slug,
schoolClass: this.isModule ? this.me.selectedClass.id : null,
},
...(this.isModule && { schoolClass: this.me.selectedClass.id }),
};
const mutation = this.isModule ? NEW_MODULE_ROOM_ENTRY_MUTATION : NEW_ROOM_ENTRY_MUTATION;
this.$apollo
@ -75,7 +77,7 @@ export default defineComponent({
},
update: (store, { data }) => {
try {
const { roomEntry } = this.isModule ? data.addRoomEntry : data.addModuleRoomEntry;
const { roomEntry } = this.isModule ? data.addModuleRoomEntry : data.addRoomEntry;
const query = ROOM_ENTRIES_QUERY;
const variables = { slug: this.slug };
const { room } = store.readQuery({ query, variables });