Fix new room entry page for default case
This commit is contained in:
parent
6e0c158330
commit
b5b4b2aa70
|
|
@ -59,10 +59,12 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
save({ title, contents }) {
|
save({ title, contents }) {
|
||||||
const entry = {
|
const entry = {
|
||||||
title,
|
...{
|
||||||
contents,
|
title,
|
||||||
roomSlug: this.slug,
|
contents,
|
||||||
schoolClass: this.isModule ? this.me.selectedClass.id : null,
|
roomSlug: this.slug,
|
||||||
|
},
|
||||||
|
...(this.isModule && { schoolClass: this.me.selectedClass.id }),
|
||||||
};
|
};
|
||||||
const mutation = this.isModule ? NEW_MODULE_ROOM_ENTRY_MUTATION : NEW_ROOM_ENTRY_MUTATION;
|
const mutation = this.isModule ? NEW_MODULE_ROOM_ENTRY_MUTATION : NEW_ROOM_ENTRY_MUTATION;
|
||||||
this.$apollo
|
this.$apollo
|
||||||
|
|
@ -75,7 +77,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
update: (store, { data }) => {
|
update: (store, { data }) => {
|
||||||
try {
|
try {
|
||||||
const { roomEntry } = this.isModule ? data.addRoomEntry : data.addModuleRoomEntry;
|
const { roomEntry } = this.isModule ? data.addModuleRoomEntry : data.addRoomEntry;
|
||||||
const query = ROOM_ENTRIES_QUERY;
|
const query = ROOM_ENTRIES_QUERY;
|
||||||
const variables = { slug: this.slug };
|
const variables = { slug: this.slug };
|
||||||
const { room } = store.readQuery({ query, variables });
|
const { room } = store.readQuery({ query, variables });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue