2019-12-20 13:04:34 +01:00
< template >
2020-09-30 10:39:46 +02:00
< section class = "section container" >
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" >
2020-11-30 10:24:11 +01: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 - m e s s a g e >
< / 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
class = "content"
v - if = "participation.event.joinOptions == EventJoinOptions.RESTRICTED"
>
{ {
$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" >
< b -message
: title = "
$t (
'Error while updating participation status inside this browser'
)
"
type = "is-warning"
>
{ {
$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."
)
} }
< / b - m e s s a g e >
< / 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 ,
params : { uuid : this . participation . event . uuid } ,
} "
> { { $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 >
< 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-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" ;
2019-12-20 13:04:34 +01:00
2021-10-10 16:24:12 +02:00
@ Component ( {
metaInfo ( ) {
return {
title : this . $t ( "Confirm participation" ) as string ,
} ;
} ,
} )
2019-12-20 13:04:34 +01:00
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 >