Show a proper error message on creating/updating an event

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-10-09 16:07:13 +02:00
parent 9430f1145f
commit 75fc1f125a
3 changed files with 14 additions and 3 deletions

View File

@@ -588,6 +588,7 @@ export default class EditEvent extends Vue {
} catch (err) {
this.saving = false;
console.error(err);
this.handleError(err);
}
}
@@ -615,7 +616,7 @@ export default class EditEvent extends Vue {
});
} catch (err) {
this.saving = false;
console.error(err);
this.handleError(err);
}
}
@@ -627,6 +628,16 @@ export default class EditEvent extends Vue {
: this.$i18n.t("The event has been updated")) as string;
}
private handleError(err: any) {
console.error(err);
if (err.graphQLErrors !== undefined) {
err.graphQLErrors.forEach(({ message }: { message: string }) => {
this.$notifier.error(message);
});
}
}
/**
* Put in cache the updated or created event.
* If the event is not a draft anymore, also put in cache the participation