Show a proper error message on creating/updating an event
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user