1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-24 00:43:02 +00:00

Improve create discussion page

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-10-22 08:40:17 +02:00
parent 2c3eb8becc
commit 0523388560
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

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