2019-12-20 12:04:34 +00:00
|
|
|
<template>
|
2020-09-30 08:39:46 +00:00
|
|
|
<section class="section container">
|
2020-10-07 15:05:15 +00:00
|
|
|
<h1 class="title" v-if="loading">{{ $t("Your participation request is being validated") }}</h1>
|
2020-02-18 07:57:00 +00:00
|
|
|
<div v-else>
|
|
|
|
<div v-if="failed">
|
2020-10-07 15:05:15 +00:00
|
|
|
<b-message :title="$t('Error while validating participation request')" type="is-danger">
|
2020-02-18 07:57:00 +00:00
|
|
|
{{
|
|
|
|
$t(
|
2020-10-07 15:05:15 +00:00
|
|
|
"Either the participation request has already been validated, either the validation token is incorrect."
|
2020-02-18 07:57:00 +00:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
</b-message>
|
|
|
|
</div>
|
2020-09-30 08:39:46 +00:00
|
|
|
<div v-else>
|
2020-10-07 15:05:15 +00: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 08:39:46 +00:00
|
|
|
</div>
|
2020-02-18 07:57:00 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
2019-12-20 12:04:34 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 07:57:00 +00:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import RouteName from "../../router/name";
|
2020-10-07 15:05:15 +00:00
|
|
|
import { EventJoinOptions, IParticipant } from "../../types/event.model";
|
2020-02-18 07:57:00 +00:00
|
|
|
import { CONFIRM_PARTICIPATION } from "../../graphql/event";
|
2019-12-20 12:04:34 +00:00
|
|
|
|
|
|
|
@Component
|
|
|
|
export default class ConfirmParticipation extends Vue {
|
|
|
|
@Prop({ type: String, required: true }) token!: string;
|
|
|
|
|
|
|
|
loading = true;
|
2020-02-18 07:57:00 +00:00
|
|
|
|
2019-12-20 12:04:34 +00:00
|
|
|
failed = false;
|
|
|
|
|
2020-09-30 08:39:46 +00:00
|
|
|
participation!: IParticipant;
|
|
|
|
|
2020-10-07 15:05:15 +00:00
|
|
|
EventJoinOptions = EventJoinOptions;
|
|
|
|
|
|
|
|
RouteName = RouteName;
|
2020-09-30 08:39:46 +00:00
|
|
|
|
2020-09-29 07:53:48 +00:00
|
|
|
async created(): Promise<void> {
|
2019-12-20 12:04:34 +00:00
|
|
|
await this.validateAction();
|
|
|
|
}
|
|
|
|
|
2020-09-29 07:53:48 +00:00
|
|
|
async validateAction(): Promise<void> {
|
2019-12-20 12:04:34 +00:00
|
|
|
try {
|
2020-02-18 07:57:00 +00:00
|
|
|
const { data } = await this.$apollo.mutate<{
|
|
|
|
confirmParticipation: IParticipant;
|
|
|
|
}>({
|
2019-12-20 12:04:34 +00:00
|
|
|
mutation: CONFIRM_PARTICIPATION,
|
|
|
|
variables: {
|
|
|
|
token: this.token,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
const { confirmParticipation: participation } = data;
|
2020-09-30 08:39:46 +00:00
|
|
|
this.participation = participation;
|
2019-12-20 12:04:34 +00:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
this.failed = true;
|
|
|
|
} finally {
|
|
|
|
this.loading = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|