2019-12-20 13:04:34 +01:00
|
|
|
<template>
|
2020-09-30 10:39:46 +02:00
|
|
|
<section class="section container">
|
2020-10-07 17:05:15 +02:00
|
|
|
<h1 class="title" v-if="loading">{{ $t("Your participation request is being validated") }}</h1>
|
2020-02-18 08:57:00 +01:00
|
|
|
<div v-else>
|
|
|
|
<div v-if="failed">
|
2020-10-07 17:05:15 +02:00
|
|
|
<b-message :title="$t('Error while validating participation request')" type="is-danger">
|
2020-02-18 08:57:00 +01:00
|
|
|
{{
|
|
|
|
$t(
|
2020-10-07 17:05:15 +02:00
|
|
|
"Either the participation request has already been validated, either the validation token is incorrect."
|
2020-02-18 08:57:00 +01:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
</b-message>
|
|
|
|
</div>
|
2020-09-30 10:39:46 +02:00
|
|
|
<div v-else>
|
2020-10-07 17:05:15 +02:00
|
|
|
<h1 class="title">{{ $t("Your participation request has been validated") }}</h1>
|
|
|
|
<p class="content" v-if="participation.event.joinOptions == EventJoinOptions.RESTRICTED">
|
|
|
|
{{ $t("Your participation still has to be approved by the organisers.") }}
|
|
|
|
</p>
|
|
|
|
<div class="columns has-text-centered">
|
|
|
|
<div class="column">
|
|
|
|
<router-link
|
|
|
|
native-type="button"
|
|
|
|
tag="a"
|
|
|
|
class="button is-primary is-large"
|
|
|
|
:to="{
|
|
|
|
name: RouteName.EVENT,
|
|
|
|
params: { uuid: this.participation.event.uuid },
|
|
|
|
}"
|
|
|
|
>{{ $t("Go to the event page") }}</router-link
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-30 10:39:46 +02:00
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
</div>
|
|
|
|
</section>
|
2019-12-20 13:04:34 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
2020-10-08 08:19:44 +02:00
|
|
|
import { confirmLocalAnonymousParticipation } from "@/services/AnonymousParticipationStorage";
|
2020-02-18 08:57:00 +01:00
|
|
|
import RouteName from "../../router/name";
|
2020-10-07 17:05:15 +02:00
|
|
|
import { EventJoinOptions, IParticipant } from "../../types/event.model";
|
2020-02-18 08:57:00 +01:00
|
|
|
import { CONFIRM_PARTICIPATION } from "../../graphql/event";
|
2019-12-20 13:04:34 +01:00
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class ConfirmParticipation extends Vue {
|
|
|
|
@Prop({ type: String, required: true }) token!: string;
|
|
|
|
|
|
|
|
loading = true;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-12-20 13:04:34 +01:00
|
|
|
failed = false;
|
|
|
|
|
2020-09-30 10:39:46 +02:00
|
|
|
participation!: IParticipant;
|
|
|
|
|
2020-10-07 17:05:15 +02:00
|
|
|
EventJoinOptions = EventJoinOptions;
|
|
|
|
|
|
|
|
RouteName = RouteName;
|
2020-09-30 10:39:46 +02:00
|
|
|
|
2020-09-29 09:53:48 +02:00
|
|
|
async created(): Promise<void> {
|
2019-12-20 13:04:34 +01:00
|
|
|
await this.validateAction();
|
|
|
|
}
|
|
|
|
|
2020-09-29 09:53:48 +02:00
|
|
|
async validateAction(): Promise<void> {
|
2019-12-20 13:04:34 +01:00
|
|
|
try {
|
2020-02-18 08:57:00 +01:00
|
|
|
const { data } = await this.$apollo.mutate<{
|
|
|
|
confirmParticipation: IParticipant;
|
|
|
|
}>({
|
2019-12-20 13:04:34 +01:00
|
|
|
mutation: CONFIRM_PARTICIPATION,
|
|
|
|
variables: {
|
|
|
|
token: this.token,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
const { confirmParticipation: participation } = data;
|
2020-09-30 10:39:46 +02:00
|
|
|
this.participation = participation;
|
2020-10-08 08:19:44 +02:00
|
|
|
await confirmLocalAnonymousParticipation(this.participation.event.uuid);
|
2019-12-20 13:04:34 +01:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
this.failed = true;
|
|
|
|
} finally {
|
|
|
|
this.loading = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|