From f0c7fd075cbb9bf3872b4152b4f1a92b480f54dc Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 2 Oct 2019 19:14:39 +0200 Subject: [PATCH] Properly handle not found event Signed-off-by: Thomas Citharel --- js/src/views/Event/Event.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index ce884a815..6e2289726 100644 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -219,6 +219,8 @@ import { CREATE_REPORT } from '@/graphql/report'; import EventMixin from '@/mixins/event'; import IdentityPicker from '@/views/Account/IdentityPicker.vue'; import ParticipationButton from '@/components/Event/ParticipationButton.vue'; +import { GraphQLError } from 'graphql'; +import { RouteName } from '@/router'; @Component({ components: { @@ -242,6 +244,9 @@ import ParticipationButton from '@/components/Event/ParticipationButton.vue'; uuid: this.uuid, }; }, + error({ graphQLErrors }) { + this.handleErrors(graphQLErrors); + }, }, currentActor: { query: CURRENT_ACTOR_CLIENT, @@ -271,7 +276,6 @@ export default class Event extends EventMixin { showMap: boolean = false; isReportModalActive: boolean = false; isJoinModalActive: boolean = false; - EventVisibility = EventVisibility; mounted() { @@ -433,6 +437,12 @@ export default class Event extends EventMixin { document.body.removeChild(link); } + async handleErrors(errors: GraphQLError) { + if (errors[0].message.includes('not found')) { + await this.$router.push({ name: RouteName.PAGE_NOT_FOUND }); + } + } + get actorIsParticipant() { if (this.actorIsOrganizer) return true;