fix: error melding
This commit is contained in:
parent
17460684aa
commit
42d84c56e5
4 changed files with 77 additions and 65 deletions
19
frontend/src/views/classes/ClassDisplay.vue
Normal file
19
frontend/src/views/classes/ClassDisplay.vue
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useClassQuery } from '@/queries/classes';
|
||||||
|
import { defineProps } from 'vue';
|
||||||
|
import UsingQueryResult from "@/components/UsingQueryResult.vue";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
classId: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
const classQuery = useClassQuery(props.classId);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<using-query-result :query-result="classQuery" v-slot="{ data: classResponse }">
|
||||||
|
<span>{{ classResponse?.class.displayName}}</span>
|
||||||
|
</using-query-result>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -125,7 +125,9 @@
|
||||||
usernameTeacher.value = "";
|
usernameTeacher.value = "";
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
console.log("error", e)
|
||||||
|
console.log(e.response.data.error)
|
||||||
|
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
showSnackbar(t("sent"), "success");
|
showSnackbar(t("sent"), "success");
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
useTeacherInvitationsReceivedQuery,
|
useTeacherInvitationsReceivedQuery,
|
||||||
} from "@/queries/teacher-invitations";
|
} from "@/queries/teacher-invitations";
|
||||||
import { useDisplay } from "vuetify";
|
import { useDisplay } from "vuetify";
|
||||||
|
import ClassDisplay from "@/views/classes/ClassDisplay.vue";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -40,7 +41,6 @@
|
||||||
|
|
||||||
// Fetch all classes of the logged in teacher
|
// Fetch all classes of the logged in teacher
|
||||||
const classesQuery = useTeacherClassesQuery(username, true);
|
const classesQuery = useTeacherClassesQuery(username, true);
|
||||||
const allClassesQuery = useClassesQuery();
|
|
||||||
const { mutate } = useCreateClassMutation();
|
const { mutate } = useCreateClassMutation();
|
||||||
const getInvitationsQuery = useTeacherInvitationsReceivedQuery(username);
|
const getInvitationsQuery = useTeacherInvitationsReceivedQuery(username);
|
||||||
const { mutate: respondToInvitation } = useRespondTeacherInvitationMutation();
|
const { mutate: respondToInvitation } = useRespondTeacherInvitationMutation();
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
await getInvitationsQuery.refetch();
|
await getInvitationsQuery.refetch();
|
||||||
},
|
},
|
||||||
onError: (e) => {
|
onError: (e) => {
|
||||||
showSnackbar(t("failed") + ": " + e.message, "error");
|
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -338,66 +338,57 @@
|
||||||
:query-result="getInvitationsQuery"
|
:query-result="getInvitationsQuery"
|
||||||
v-slot="invitationsResponse: { data: TeacherInvitationsResponse }"
|
v-slot="invitationsResponse: { data: TeacherInvitationsResponse }"
|
||||||
>
|
>
|
||||||
<using-query-result
|
<tr
|
||||||
:query-result="allClassesQuery"
|
v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]"
|
||||||
v-slot="classesResponse: { data: ClassesResponse }"
|
:key="i.classId"
|
||||||
>
|
>
|
||||||
<tr
|
<td>
|
||||||
v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]"
|
<ClassDisplay :classId="i.classId" />
|
||||||
:key="i.classId"
|
</td>
|
||||||
>
|
<td>
|
||||||
<td>
|
{{
|
||||||
{{
|
(i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName
|
||||||
(classesResponse.data.classes as ClassDTO[]).filter(
|
}}
|
||||||
(c) => c.id == i.classId,
|
</td>
|
||||||
)[0].displayName
|
<td class="text-right">
|
||||||
}}
|
<span v-if="!isSmAndDown">
|
||||||
</td>
|
<div>
|
||||||
<td>
|
<v-btn
|
||||||
{{
|
color="green"
|
||||||
(i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName
|
@click="handleInvitation(i, true)"
|
||||||
}}
|
class="mr-2"
|
||||||
</td>
|
>
|
||||||
<td class="text-right">
|
{{ t("accept") }}
|
||||||
<span v-if="!isSmAndDown">
|
</v-btn>
|
||||||
<div>
|
<v-btn
|
||||||
<v-btn
|
color="red"
|
||||||
color="green"
|
@click="handleInvitation(i, false)"
|
||||||
@click="handleInvitation(i, true)"
|
>
|
||||||
class="mr-2"
|
{{ t("deny") }}
|
||||||
>
|
</v-btn>
|
||||||
{{ t("accept") }}
|
</div>
|
||||||
</v-btn>
|
</span>
|
||||||
<v-btn
|
<span v-else>
|
||||||
color="red"
|
<div>
|
||||||
@click="handleInvitation(i, false)"
|
<v-btn
|
||||||
>
|
@click="handleInvitation(i, true)"
|
||||||
{{ t("deny") }}
|
class="mr-2"
|
||||||
</v-btn>
|
icon="mdi-check-circle"
|
||||||
</div>
|
color="green"
|
||||||
</span>
|
variant="text"
|
||||||
<span v-else>
|
>
|
||||||
<div>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
@click="handleInvitation(i, true)"
|
@click="handleInvitation(i, false)"
|
||||||
class="mr-2"
|
class="mr-2"
|
||||||
icon="mdi-check-circle"
|
icon="mdi-close-circle"
|
||||||
color="green"
|
color="red"
|
||||||
variant="text"
|
variant="text"
|
||||||
>
|
>
|
||||||
</v-btn>
|
</v-btn></div
|
||||||
<v-btn
|
></span>
|
||||||
@click="handleInvitation(i, false)"
|
</td>
|
||||||
class="mr-2"
|
</tr>
|
||||||
icon="mdi-close-circle"
|
|
||||||
color="red"
|
|
||||||
variant="text"
|
|
||||||
>
|
|
||||||
</v-btn></div
|
|
||||||
></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</using-query-result>
|
|
||||||
</using-query-result>
|
</using-query-result>
|
||||||
</tbody>
|
</tbody>
|
||||||
</v-table>
|
</v-table>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue