fix(front): fix confirm anonymous participation

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-08-24 09:51:07 +02:00
parent beef3ff16d
commit f99267c611
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -67,7 +67,7 @@ import { EventJoinOptions } from "@/types/enums";
import { IParticipant } from "../../types/participant.model";
import RouteName from "../../router/name";
import { CONFIRM_PARTICIPATION } from "../../graphql/event";
import { computed, ref } from "vue";
import { computed, ref, watchEffect } from "vue";
import { useMutation } from "@vue/apollo-composable";
import { useI18n } from "vue-i18n";
import { useHead } from "@vueuse/head";
@ -90,9 +90,15 @@ const { onDone, onError, mutate } = useMutation<{
confirmParticipation: IParticipant;
}>(CONFIRM_PARTICIPATION);
mutate(() => ({
token: props.token,
}));
const participationToken = computed(() => props.token);
watchEffect(() => {
if (participationToken.value) {
mutate({
token: participationToken.value,
});
}
});
onDone(async ({ data }) => {
participation.value = data?.confirmParticipation;