Improve and activate groups
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import { SnackbarProgrammatic as Snackbar } from "buefy";
|
||||
import RouteName from "../../router/name";
|
||||
import { IParticipant } from "../../types/event.model";
|
||||
import { CONFIRM_PARTICIPATION } from "../../graphql/event";
|
||||
@@ -31,11 +32,11 @@ export default class ConfirmParticipation extends Vue {
|
||||
|
||||
failed = false;
|
||||
|
||||
async created() {
|
||||
async created(): Promise<void> {
|
||||
await this.validateAction();
|
||||
}
|
||||
|
||||
async validateAction() {
|
||||
async validateAction(): Promise<void> {
|
||||
try {
|
||||
const { data } = await this.$apollo.mutate<{
|
||||
confirmParticipation: IParticipant;
|
||||
@@ -56,6 +57,8 @@ export default class ConfirmParticipation extends Vue {
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
||||
Snackbar.open({ message: err.message, type: "is-danger", position: "is-bottom" });
|
||||
this.failed = true;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
|
||||
@@ -66,6 +66,7 @@ import { FETCH_EVENT, JOIN_EVENT } from "@/graphql/event";
|
||||
import { IConfig } from "@/types/config.model";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import { addLocalUnconfirmedAnonymousParticipation } from "@/services/AnonymousParticipationStorage";
|
||||
import { Route } from "vue-router";
|
||||
import RouteName from "../../router/name";
|
||||
|
||||
@Component({
|
||||
@@ -101,7 +102,7 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
|
||||
EventJoinOptions = EventJoinOptions;
|
||||
|
||||
async joinEvent() {
|
||||
async joinEvent(): Promise<Route> {
|
||||
this.error = false;
|
||||
try {
|
||||
const { data } = await this.$apollo.mutate<{ joinEvent: IParticipant }>({
|
||||
@@ -134,10 +135,10 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
}
|
||||
|
||||
if (data.joinEvent.role === ParticipantRole.NOT_CONFIRMED) {
|
||||
event.participantStats.notConfirmed = event.participantStats.notConfirmed + 1;
|
||||
event.participantStats.notConfirmed += 1;
|
||||
} else {
|
||||
event.participantStats.going = event.participantStats.going + 1;
|
||||
event.participantStats.participant = event.participantStats.participant + 1;
|
||||
event.participantStats.going += 1;
|
||||
event.participantStats.participant += 1;
|
||||
}
|
||||
console.log("just before writequery");
|
||||
|
||||
@@ -157,18 +158,12 @@ export default class ParticipationWithoutAccount extends Vue {
|
||||
console.log("done with crypto stuff");
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (e.message === "GraphQL error: You are already a participant of this event") {
|
||||
this.error = this.$t(
|
||||
"This email is already registered as participant for this event"
|
||||
) as string;
|
||||
}
|
||||
} finally {
|
||||
return this.$router.push({
|
||||
name: RouteName.EVENT,
|
||||
params: { uuid: this.event.uuid },
|
||||
});
|
||||
this.error = e.message;
|
||||
}
|
||||
return this.$router.push({
|
||||
name: RouteName.EVENT,
|
||||
params: { uuid: this.event.uuid },
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user