2019-12-20 13:04:34 +01:00
< template >
2022-07-12 10:55:28 +02:00
< section class = "container mx-auto" >
2020-11-30 10:24:11 +01:00
< h1 class = "title" v-if ="loading" >
2022-08-26 16:08:58 +02:00
{ { t ( "Your participation request is being validated" ) } }
2020-11-30 10:24:11 +01:00
< / h1 >
2020-02-18 08:57:00 +01:00
< div v-else >
2021-06-27 18:17:02 +02:00
< div v-if ="failed && participation === undefined" >
2022-07-12 10:55:28 +02:00
< o -notification
2022-08-26 16:08:58 +02:00
: title = "t('Error while validating participation request')"
2022-07-12 10:55:28 +02:00
variant = "danger"
2020-11-30 10:24:11 +01:00
>
2020-02-18 08:57:00 +01:00
{ {
2022-08-26 16:08:58 +02: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
)
} }
2022-07-12 10:55:28 +02:00
< / o - n o t i f i c a t i o n >
2020-02-18 08:57:00 +01:00
< / div >
2020-09-30 10:39:46 +02:00
< div v-else >
2020-11-30 10:24:11 +01:00
< h1 class = "title" >
2022-08-26 16:08:58 +02:00
{ { t ( "Your participation request has been validated" ) } }
2020-11-30 10:24:11 +01:00
< / h1 >
< p
2022-07-12 10:55:28 +02:00
class = "prose dark:prose-invert"
v - if = "participation?.event.joinOptions == EventJoinOptions.RESTRICTED"
2020-11-30 10:24:11 +01:00
>
{ {
2022-08-26 16:08:58 +02:00
t ( "Your participation still has to be approved by the organisers." )
2020-11-30 10:24:11 +01:00
} }
2020-10-07 17:05:15 +02:00
< / p >
2021-06-27 18:17:02 +02:00
< div v-if ="failed" >
2022-07-12 10:55:28 +02:00
< o -notification
2021-06-27 18:17:02 +02:00
: title = "
2022-08-26 16:08:58 +02:00
t ( 'Error while updating participation status inside this browser' )
2021-06-27 18:17:02 +02:00
"
2022-07-12 10:55:28 +02:00
variant = "warning"
2021-06-27 18:17:02 +02:00
>
{ {
2022-08-26 16:08:58 +02:00
t (
2021-06-27 18:17:02 +02:00
"We couldn't save your participation inside this browser. Not to worry, you have successfully confirmed your participation, we just couldn't save it's status in this browser because of a technical issue."
)
} }
2022-07-12 10:55:28 +02:00
< / o - n o t i f i c a t i o n >
2021-06-27 18:17:02 +02:00
< / div >
2020-10-07 17:05:15 +02:00
< div class = "columns has-text-centered" >
< div class = "column" >
2022-08-26 16:08:58 +02:00
< o -button
tag = "router-link"
variant = "primary"
size = "large"
2020-10-07 17:05:15 +02:00
: to = " {
name : RouteName . EVENT ,
2022-07-12 10:55:28 +02:00
params : { uuid : participation ? . event . uuid } ,
2020-10-07 17:05:15 +02:00
} "
2022-08-26 16:08:58 +02:00
> { { t ( "Go to the event page" ) } } < / o - b u t t o n
2020-10-07 17:05:15 +02:00
>
< / 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 >
2022-07-12 10:55:28 +02:00
< script lang = "ts" setup >
2020-10-08 08:19:44 +02:00
import { confirmLocalAnonymousParticipation } from "@/services/AnonymousParticipationStorage" ;
2020-11-27 19:27:44 +01:00
import { EventJoinOptions } from "@/types/enums" ;
2020-11-06 11:34:32 +01:00
import { IParticipant } from "../../types/participant.model" ;
2020-02-18 08:57:00 +01:00
import RouteName from "../../router/name" ;
import { CONFIRM _PARTICIPATION } from "../../graphql/event" ;
2023-08-24 09:51:07 +02:00
import { computed , ref , watchEffect } from "vue" ;
2022-07-12 10:55:28 +02:00
import { useMutation } from "@vue/apollo-composable" ;
import { useI18n } from "vue-i18n" ;
2023-11-21 16:04:09 +01:00
import { useHead } from "@unhead/vue" ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
const { t } = useI18n ( { useScope : "global" } ) ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
useHead ( {
title : computed ( ( ) => t ( "Confirm participation" ) ) ,
} ) ;
2020-02-18 08:57:00 +01:00
2022-07-12 10:55:28 +02:00
const props = defineProps < {
token : string ;
} > ( ) ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
const loading = ref ( true ) ;
const failed = ref ( false ) ;
const participation = ref < IParticipant | null | undefined > ( null ) ;
2020-09-30 10:39:46 +02:00
2022-07-12 10:55:28 +02:00
const { onDone , onError , mutate } = useMutation < {
confirmParticipation : IParticipant ;
} > ( CONFIRM _PARTICIPATION ) ;
2020-10-07 17:05:15 +02:00
2023-08-24 09:51:07 +02:00
const participationToken = computed ( ( ) => props . token ) ;
watchEffect ( ( ) => {
if ( participationToken . value ) {
mutate ( {
token : participationToken . value ,
} ) ;
}
} ) ;
2020-09-30 10:39:46 +02:00
2022-07-12 10:55:28 +02:00
onDone ( async ( { data } ) => {
participation . value = data ? . confirmParticipation ;
if ( participation . value ) {
await confirmLocalAnonymousParticipation ( participation . value ? . event . uuid ) ;
2019-12-20 13:04:34 +01:00
}
2022-07-12 10:55:28 +02:00
loading . value = false ;
} ) ;
2019-12-20 13:04:34 +01:00
2022-07-12 10:55:28 +02:00
onError ( ( err ) => {
console . error ( err ) ;
failed . value = true ;
loading . value = false ;
} ) ;
2019-12-20 13:04:34 +01:00
< / script >