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" >
{ { $t ( "Your participation request is being validated" ) } }
< / 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
2020-11-30 10:24:11 +01: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
{ {
$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" >
{ { $t ( "Your participation request has been validated" ) } }
< / 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
>
{ {
$t ( "Your participation still has to be approved by the organisers." )
} }
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 = "
$t (
'Error while updating participation status inside this browser'
)
"
2022-07-12 10:55:28 +02:00
variant = "warning"
2021-06-27 18:17:02 +02:00
>
{ {
$t (
"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" >
< router -link
native - type = "button"
tag = "a"
class = "button is-primary is-large"
: 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
} "
> { { $t ( "Go to the event page" ) } } < / r o u t e r - l i n k
>
< / 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" ;
2022-07-12 10:55:28 +02:00
import { computed , ref } from "vue" ;
import { useMutation } from "@vue/apollo-composable" ;
import { useI18n } from "vue-i18n" ;
import { useHead } from "@vueuse/head" ;
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
2022-07-12 10:55:28 +02:00
mutate ( {
token : props . token ,
} ) ;
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 >