Merge branch 'improve-create-discussion-page' into 'master'

Improve create discussion page

See merge request framasoft/mobilizon!632
This commit is contained in:
Thomas Citharel 2020-10-22 08:57:39 +02:00
commit 739516d2fd

View File

@ -44,7 +44,7 @@ import RouteName from "../../router/name";
}, },
metaInfo() { metaInfo() {
return { return {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
title: this.$t("Create a discussion") as string, title: this.$t("Create a discussion") as string,
// all titles will be injected into this template // all titles will be injected into this template
@ -61,7 +61,7 @@ export default class CreateDiscussion extends Vue {
discussion = { title: "", text: "" }; discussion = { title: "", text: "" };
async createDiscussion() { async createDiscussion(): Promise<void> {
try { try {
const { data } = await this.$apollo.mutate({ const { data } = await this.$apollo.mutate({
mutation: CREATE_DISCUSSION, mutation: CREATE_DISCUSSION,
@ -71,9 +71,6 @@ export default class CreateDiscussion extends Vue {
actorId: this.group.id, actorId: this.group.id,
creatorId: this.currentActor.id, creatorId: this.currentActor.id,
}, },
// update: (store, { data: { createDiscussion } }) => {
// // TODO: update group list cache
// },
}); });
await this.$router.push({ await this.$router.push({
@ -83,8 +80,11 @@ export default class CreateDiscussion extends Vue {
slug: data.createDiscussion.slug, slug: data.createDiscussion.slug,
}, },
}); });
} catch (err) { } catch (error) {
console.error(err); console.error(error);
if (error.graphQLErrors && error.graphQLErrors.length > 0) {
this.$notifier.error(error.graphQLErrors[0].message);
}
} }
} }
} }