fix: questions worden meteen herladen bij aanmaken nieuwe question zodat deze meteen getoond wordt
This commit is contained in:
parent
84b2cb1749
commit
8e50bdef21
3 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import authService from "@/services/auth/auth-service.ts";
|
||||
import { Language } from "@/data-objects/language.ts";
|
||||
import { computed, type ComputedRef, ref } from "vue";
|
||||
import { computed, type ComputedRef, onUpdated, ref } from "vue";
|
||||
import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment";
|
||||
import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students.ts";
|
||||
import type { GroupDTO, GroupDTOId } from "@dwengo-1/common/interfaces/group";
|
||||
|
@ -24,6 +24,8 @@
|
|||
|
||||
const { t } = useI18n();
|
||||
|
||||
const emit = defineEmits(["updated"]);
|
||||
|
||||
const studentAssignmentsQueryResult = useStudentAssignmentsQuery(
|
||||
authService.authState.user?.profile.preferred_username,
|
||||
);
|
||||
|
@ -87,6 +89,7 @@
|
|||
onSuccess: async () => {
|
||||
questionInput.value = ""; // Clear the input field after submission
|
||||
await getQuestionsQuery.refetch(); // Reload the questions
|
||||
emit("updated");
|
||||
},
|
||||
onError: (_) => {
|
||||
// TODO Handle error
|
||||
|
|
|
@ -28,6 +28,7 @@ export class QuestionController extends BaseController {
|
|||
}
|
||||
|
||||
async getAll(full = true): Promise<QuestionsResponse> {
|
||||
console.log("AAAAAAAAAAAAAAAAAAAAAAAAAa");
|
||||
return this.get<QuestionsResponse>("/", { lang: this.loId.language, full });
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,10 @@
|
|||
);
|
||||
}
|
||||
|
||||
function refetchQuestions() {
|
||||
getQuestionsQuery.refetch();
|
||||
}
|
||||
|
||||
const navigationDrawerShown = ref(true);
|
||||
|
||||
function isLearningObjectCompleted(learningObject: LearningObject): boolean {
|
||||
|
@ -354,6 +358,7 @@
|
|||
:language="props.language"
|
||||
:learningObjectHruid="props.learningObjectHruid"
|
||||
:forGroup="forGroup"
|
||||
@updated="refetchQuestions"
|
||||
/>
|
||||
<QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" />
|
||||
</using-query-result>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue