Fix accepting group invitations

Closes #1170

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-10-26 18:25:56 +02:00
parent e446df938f
commit 688bdccc24
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -4,8 +4,8 @@
v-for="member in invitations"
:key="member.id"
:member="member"
@accept="acceptInvitation"
@reject="rejectInvitation"
@accept="acceptInvitation({ id: member.id })"
@reject="rejectInvitation({ id: member.id })"
/>
</section>
</template>
@ -25,7 +25,9 @@ defineProps<{
}>();
const { mutate: acceptInvitation, onError: onAcceptInvitationError } =
useMutation(ACCEPT_INVITATION, {
useMutation<{ acceptInvitation: IMember }, { id: string }>(
ACCEPT_INVITATION,
{
refetchQueries({ data }) {
const profile = data?.acceptInvitation?.actor as IPerson;
const group = data?.acceptInvitation?.parent as IGroup;
@ -39,7 +41,8 @@ const { mutate: acceptInvitation, onError: onAcceptInvitationError } =
}
return [];
},
});
}
);
const notifier = inject<Notifier>("notifier");
@ -53,7 +56,9 @@ const onError = (error: ErrorResponse) => {
onAcceptInvitationError((err) => onError(err as unknown as ErrorResponse));
const { mutate: rejectInvitation, onError: onRejectInvitationError } =
useMutation(REJECT_INVITATION, {
useMutation<{ rejectInvitation: IMember }, { id: string }>(
REJECT_INVITATION,
{
refetchQueries({ data }) {
const profile = data?.rejectInvitation?.actor as IPerson;
const group = data?.rejectInvitation?.parent as IGroup;
@ -67,7 +72,8 @@ const { mutate: rejectInvitation, onError: onRejectInvitationError } =
}
return [];
},
});
}
);
onRejectInvitationError((err) => onError(err as unknown as ErrorResponse));
</script>