fix: v-else op verkeerde plaats
This commit is contained in:
parent
e297f25888
commit
c3d93f766d
1 changed files with 29 additions and 19 deletions
|
@ -10,7 +10,11 @@
|
||||||
import UsingQueryResult from "@/components/UsingQueryResult.vue";
|
import UsingQueryResult from "@/components/UsingQueryResult.vue";
|
||||||
import { useClassesQuery, useClassTeacherInvitationsQuery, useCreateClassMutation } from "@/queries/classes";
|
import { useClassesQuery, useClassTeacherInvitationsQuery, useCreateClassMutation } from "@/queries/classes";
|
||||||
import type { TeacherInvitationsResponse } from "@/controllers/teacher-invitations";
|
import type { TeacherInvitationsResponse } from "@/controllers/teacher-invitations";
|
||||||
import { useRespondTeacherInvitationMutation, useTeacherInvitationsReceivedQuery, useTeacherInvitationsSentQuery } from "@/queries/teacher-invitations";
|
import {
|
||||||
|
useRespondTeacherInvitationMutation,
|
||||||
|
useTeacherInvitationsReceivedQuery,
|
||||||
|
useTeacherInvitationsSentQuery,
|
||||||
|
} from "@/queries/teacher-invitations";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -50,18 +54,23 @@ import { useRespondTeacherInvitationMutation, useTeacherInvitationsReceivedQuery
|
||||||
|
|
||||||
// Function to handle an invitation request
|
// Function to handle an invitation request
|
||||||
function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void {
|
function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void {
|
||||||
const data: TeacherInvitationData = {sender: (ti.sender as TeacherDTO).id, receiver: (ti.receiver as TeacherDTO).id, class: ti.classId, accepted: accepted};
|
const data: TeacherInvitationData = {
|
||||||
|
sender: (ti.sender as TeacherDTO).id,
|
||||||
|
receiver: (ti.receiver as TeacherDTO).id,
|
||||||
|
class: ti.classId,
|
||||||
|
accepted: accepted,
|
||||||
|
};
|
||||||
respondToInvitation(data, {
|
respondToInvitation(data, {
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
if (accepted){
|
if (accepted) {
|
||||||
await classesQuery.refetch();
|
await classesQuery.refetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
await getInvitationsQuery.refetch();
|
await getInvitationsQuery.refetch();
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
showSnackbar(t("failed") + ": " + e.message, "error");
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,19 +140,19 @@ import { useRespondTeacherInvitationMutation, useTeacherInvitationsReceivedQuery
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main>
|
||||||
<div
|
<div
|
||||||
class="loading-div"
|
class="loading-div"
|
||||||
v-if="isLoading"
|
v-if="isLoading"
|
||||||
>
|
>
|
||||||
<v-progress-circular indeterminate></v-progress-circular>
|
<v-progress-circular indeterminate></v-progress-circular>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isError">
|
<div v-if="isError">
|
||||||
<v-empty-state
|
<v-empty-state
|
||||||
icon="mdi-alert-circle-outline"
|
icon="mdi-alert-circle-outline"
|
||||||
:text="errorMessage"
|
:text="errorMessage"
|
||||||
:title="t('error_title')"
|
:title="t('error_title')"
|
||||||
></v-empty-state>
|
></v-empty-state>
|
||||||
</div v-else>
|
</div>
|
||||||
<div>
|
<div v-else>
|
||||||
<h1 class="title">{{ t("classes") }}</h1>
|
<h1 class="title">{{ t("classes") }}</h1>
|
||||||
<using-query-result
|
<using-query-result
|
||||||
:query-result="classesQuery"
|
:query-result="classesQuery"
|
||||||
|
@ -294,7 +303,8 @@ import { useRespondTeacherInvitationMutation, useTeacherInvitationsReceivedQuery
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
{{
|
{{
|
||||||
(classesResponse.data.classes as ClassDTO[]).filter((c) => c.id == i.classId)[0].displayName
|
(classesResponse.data.classes as ClassDTO[]).filter((c) => c.id == i.classId)[0]
|
||||||
|
.displayName
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue