feat: show error message for invitation accept

This commit is contained in:
Reto Aebersold 2023-12-21 10:49:42 +01:00
parent 04b944711e
commit b0849addfd
1 changed files with 12 additions and 1 deletions

View File

@ -7,7 +7,15 @@ const props = defineProps<{
invitationId: string; invitationId: string;
}>(); }>();
const { data, error } = useCSRFFetch(`/api/mentor/${props.courseId}/invitations/accept`) const { data, error } = useCSRFFetch(
`/api/mentor/${props.courseId}/invitations/accept`,
{
onFetchError(ctx) {
ctx.error = ctx.data;
return ctx;
},
}
)
.post({ .post({
invitation_id: props.invitationId, invitation_id: props.invitationId,
}) })
@ -31,6 +39,9 @@ const { data, error } = useCSRFFetch(`/api/mentor/${props.courseId}/invitations/
<div> <div>
<a class="underline" href="mailto:help@vbv.ch">help@vbv.ch</a> <a class="underline" href="mailto:help@vbv.ch">help@vbv.ch</a>
</div> </div>
<div v-if="error.message" class="my-4">
{{ $t("a.Fehlermeldung") }}: {{ error.message }}
</div>
</template> </template>
<template v-else> <template v-else>
<i18next <i18next