Handle errors better

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-10-13 13:56:24 +02:00
parent 57f0b5dad1
commit 33e51a05ec
13 changed files with 214 additions and 78 deletions

View File

@@ -385,6 +385,14 @@ export default class EditEvent extends Vue {
refetchQueries: ({ data: { createEvent } }) => this.postRefetchQueries(createEvent),
});
this.$buefy.notification.open({
message: (this.event.draft ?
this.$i18n.t('The event has been created as a draft') :
this.$i18n.t('The event has been published')) as string,
type: 'is-success',
position: 'is-bottom-right',
duration: 5000,
});
await this.$router.push({
name: 'Event',
params: { uuid: data.createEvent.uuid },
@@ -403,6 +411,12 @@ export default class EditEvent extends Vue {
refetchQueries: ({ data: { updateEvent } }) => this.postRefetchQueries(updateEvent),
});
this.$buefy.notification.open({
message: this.updateEventMessage,
type: 'is-success',
position: 'is-bottom-right',
duration: 5000,
});
await this.$router.push({
name: 'Event',
params: { uuid: this.eventId as string },
@@ -412,6 +426,11 @@ export default class EditEvent extends Vue {
}
}
get updateEventMessage(): string {
if (this.unmodifiedEvent.draft && !this.event.draft) return this.$i18n.t('The event has been updated and published') as string;
return (this.event.draft ? this.$i18n.t('The draft event has been updated') : this.$i18n.t('The event has been updated')) as string;
}
/**
* Put in cache the updated or created event.
* If the event is not a draft anymore, also put in cache the participation