Ask to save anonymous participation in browser after email confirmation

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-09-30 10:39:46 +02:00
parent cc4ddbbb93
commit 9ceda224d3
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -1,5 +1,5 @@
<template> <template>
<section class="container"> <section class="section container">
<h1 class="title" v-if="loading">{{ $t("Your participation is being validated") }}</h1> <h1 class="title" v-if="loading">{{ $t("Your participation is being validated") }}</h1>
<div v-else> <div v-else>
<div v-if="failed"> <div v-if="failed">
@ -11,7 +11,24 @@
}} }}
</b-message> </b-message>
</div> </div>
<h1 class="title" v-else>{{ $t("Your participation has been validated") }}</h1> <div v-else>
<h1 class="title">{{ $t("Your participation has been validated") }}</h1>
<form @submit.prevent="askToSaveParticipation">
<b-field>
<b-checkbox v-model="saveParticipation">
<b>{{ $t("Remember my participation in this browser") }}</b>
<p>
{{
$t(
"Will allow to display and manage your participation status on the event page when using this device. Uncheck if you're using a public device."
)
}}
</p>
</b-checkbox>
</b-field>
<b-button native-type="submit" type="is-primary">{{ $t("Visit event page") }}</b-button>
</form>
</div>
</div> </div>
</section> </section>
</template> </template>
@ -32,6 +49,10 @@ export default class ConfirmParticipation extends Vue {
failed = false; failed = false;
participation!: IParticipant;
saveParticipation = true;
async created(): Promise<void> { async created(): Promise<void> {
await this.validateAction(); await this.validateAction();
} }
@ -49,11 +70,7 @@ export default class ConfirmParticipation extends Vue {
if (data) { if (data) {
const { confirmParticipation: participation } = data; const { confirmParticipation: participation } = data;
await confirmLocalAnonymousParticipation(participation.event.uuid); this.participation = participation;
await this.$router.replace({
name: RouteName.EVENT,
params: { uuid: data.confirmParticipation.event.uuid },
});
} }
} catch (err) { } catch (err) {
console.error(err); console.error(err);
@ -64,5 +81,23 @@ export default class ConfirmParticipation extends Vue {
this.loading = false; this.loading = false;
} }
} }
askToSaveParticipation(): void {
if (this.saveParticipation) {
this.saveParticipationInBrowser();
}
this.forwardToEventPage();
}
async saveParticipationInBrowser(): Promise<void> {
await confirmLocalAnonymousParticipation(this.participation.event.uuid);
}
async forwardToEventPage(): Promise<void> {
await this.$router.replace({
name: RouteName.EVENT,
params: { uuid: this.participation.event.uuid },
});
}
} }
</script> </script>