Merge branch 'feature/drafts' into 'master'

Properly handle not found event

See merge request framasoft/mobilizon!215
This commit is contained in:
Thomas Citharel 2019-10-02 19:23:58 +02:00
commit aef8884973

View File

@ -219,6 +219,8 @@ import { CREATE_REPORT } from '@/graphql/report';
import EventMixin from '@/mixins/event'; import EventMixin from '@/mixins/event';
import IdentityPicker from '@/views/Account/IdentityPicker.vue'; import IdentityPicker from '@/views/Account/IdentityPicker.vue';
import ParticipationButton from '@/components/Event/ParticipationButton.vue'; import ParticipationButton from '@/components/Event/ParticipationButton.vue';
import { GraphQLError } from 'graphql';
import { RouteName } from '@/router';
@Component({ @Component({
components: { components: {
@ -242,6 +244,9 @@ import ParticipationButton from '@/components/Event/ParticipationButton.vue';
uuid: this.uuid, uuid: this.uuid,
}; };
}, },
error({ graphQLErrors }) {
this.handleErrors(graphQLErrors);
},
}, },
currentActor: { currentActor: {
query: CURRENT_ACTOR_CLIENT, query: CURRENT_ACTOR_CLIENT,
@ -271,7 +276,6 @@ export default class Event extends EventMixin {
showMap: boolean = false; showMap: boolean = false;
isReportModalActive: boolean = false; isReportModalActive: boolean = false;
isJoinModalActive: boolean = false; isJoinModalActive: boolean = false;
EventVisibility = EventVisibility; EventVisibility = EventVisibility;
mounted() { mounted() {
@ -433,6 +437,12 @@ export default class Event extends EventMixin {
document.body.removeChild(link); 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() { get actorIsParticipant() {
if (this.actorIsOrganizer) return true; if (this.actorIsOrganizer) return true;