Properly handle not found event

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-02 19:14:39 +02:00
parent 442a011490
commit 30d901605d
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -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;