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"); | ||||||
|             }, |             }, | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  | @ -337,21 +337,13 @@ | ||||||
|                         <using-query-result |                         <using-query-result | ||||||
|                             :query-result="getInvitationsQuery" |                             :query-result="getInvitationsQuery" | ||||||
|                             v-slot="invitationsResponse: { data: TeacherInvitationsResponse }" |                             v-slot="invitationsResponse: { data: TeacherInvitationsResponse }" | ||||||
|                         > |  | ||||||
|                             <using-query-result |  | ||||||
|                                 :query-result="allClassesQuery" |  | ||||||
|                                 v-slot="classesResponse: { data: ClassesResponse }" |  | ||||||
|                         > |                         > | ||||||
|                             <tr |                             <tr | ||||||
|                                 v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]" |                                 v-for="i in invitationsResponse.data.invitations as TeacherInvitationDTO[]" | ||||||
|                                 :key="i.classId" |                                 :key="i.classId" | ||||||
|                             > |                             > | ||||||
|                                 <td> |                                 <td> | ||||||
|                                         {{ |                                     <ClassDisplay :classId="i.classId" /> | ||||||
|                                             (classesResponse.data.classes as ClassDTO[]).filter( |  | ||||||
|                                                 (c) => c.id == i.classId, |  | ||||||
|                                             )[0].displayName |  | ||||||
|                                         }} |  | ||||||
|                                 </td> |                                 </td> | ||||||
|                                 <td> |                                 <td> | ||||||
|                                     {{ |                                     {{ | ||||||
|  | @ -398,7 +390,6 @@ | ||||||
|                                 </td> |                                 </td> | ||||||
|                             </tr> |                             </tr> | ||||||
|                         </using-query-result> |                         </using-query-result> | ||||||
|                         </using-query-result> |  | ||||||
|                     </tbody> |                     </tbody> | ||||||
|                 </v-table> |                 </v-table> | ||||||
|             </v-container> |             </v-container> | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl