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"> | <script setup lang="ts"> | ||||||
|     import authService from "@/services/auth/auth-service.ts"; |     import authService from "@/services/auth/auth-service.ts"; | ||||||
|     import { Language } from "@/data-objects/language.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 type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; | ||||||
|     import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students.ts"; |     import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students.ts"; | ||||||
|     import type { GroupDTO, GroupDTOId } from "@dwengo-1/common/interfaces/group"; |     import type { GroupDTO, GroupDTOId } from "@dwengo-1/common/interfaces/group"; | ||||||
|  | @ -24,6 +24,8 @@ | ||||||
| 
 | 
 | ||||||
|     const { t } = useI18n(); |     const { t } = useI18n(); | ||||||
| 
 | 
 | ||||||
|  |     const emit = defineEmits(["updated"]); | ||||||
|  | 
 | ||||||
|     const studentAssignmentsQueryResult = useStudentAssignmentsQuery( |     const studentAssignmentsQueryResult = useStudentAssignmentsQuery( | ||||||
|         authService.authState.user?.profile.preferred_username, |         authService.authState.user?.profile.preferred_username, | ||||||
|     ); |     ); | ||||||
|  | @ -87,6 +89,7 @@ | ||||||
|                 onSuccess: async () => { |                 onSuccess: async () => { | ||||||
|                     questionInput.value = ""; // Clear the input field after submission |                     questionInput.value = ""; // Clear the input field after submission | ||||||
|                     await getQuestionsQuery.refetch(); // Reload the questions |                     await getQuestionsQuery.refetch(); // Reload the questions | ||||||
|  |                     emit("updated"); | ||||||
|                 }, |                 }, | ||||||
|                 onError: (_) => { |                 onError: (_) => { | ||||||
|                     // TODO Handle error |                     // TODO Handle error | ||||||
|  |  | ||||||
|  | @ -28,6 +28,7 @@ export class QuestionController extends BaseController { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async getAll(full = true): Promise<QuestionsResponse> { |     async getAll(full = true): Promise<QuestionsResponse> { | ||||||
|  |         console.log("AAAAAAAAAAAAAAAAAAAAAAAAAa"); | ||||||
|         return this.get<QuestionsResponse>("/", { lang: this.loId.language, full }); |         return this.get<QuestionsResponse>("/", { lang: this.loId.language, full }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -105,6 +105,10 @@ | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     function refetchQuestions() { | ||||||
|  |         getQuestionsQuery.refetch(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const navigationDrawerShown = ref(true); |     const navigationDrawerShown = ref(true); | ||||||
| 
 | 
 | ||||||
|     function isLearningObjectCompleted(learningObject: LearningObject): boolean { |     function isLearningObjectCompleted(learningObject: LearningObject): boolean { | ||||||
|  | @ -354,6 +358,7 @@ | ||||||
|                 :language="props.language" |                 :language="props.language" | ||||||
|                 :learningObjectHruid="props.learningObjectHruid" |                 :learningObjectHruid="props.learningObjectHruid" | ||||||
|                 :forGroup="forGroup" |                 :forGroup="forGroup" | ||||||
|  |                 @updated="refetchQuestions" | ||||||
|             /> |             /> | ||||||
|             <QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" /> |             <QandA :questions="(questionsResponse.data.questions as QuestionDTO[]) ?? []" /> | ||||||
|         </using-query-result> |         </using-query-result> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 laurejablonski
						laurejablonski