feat: class queries assignments GET
This commit is contained in:
		
							parent
							
								
									c05ad9a702
								
							
						
					
					
						commit
						a2ae431957
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		|  | @ -20,6 +20,9 @@ function classTeachersKey(classid: string) { | ||||||
| function classTeacherInvitationsKey(classid: string) { | function classTeacherInvitationsKey(classid: string) { | ||||||
|     return ["class-teacher-invitations", classid]; |     return ["class-teacher-invitations", classid]; | ||||||
| } | } | ||||||
|  | function classAssignmentsKey(classid: string) { | ||||||
|  |     return ["class-assignments", classid]; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| export function useClassesQuery(full: MaybeRefOrGetter<boolean> = true): UseQueryReturnType<ClassesResponse, Error> { | export function useClassesQuery(full: MaybeRefOrGetter<boolean> = true): UseQueryReturnType<ClassesResponse, Error> { | ||||||
|     return useQuery({ |     return useQuery({ | ||||||
|  | @ -69,4 +72,15 @@ export function useClassTeacherInvitationsQuery( | ||||||
|         queryFn: async () => classController.getTeacherInvitations(toValue(id)!, toValue(full)!), |         queryFn: async () => classController.getTeacherInvitations(toValue(id)!, toValue(full)!), | ||||||
|         enabled: () => Boolean(toValue(id)), |         enabled: () => Boolean(toValue(id)), | ||||||
|     }); |     }); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function useClassAssignmentsQuery( | ||||||
|  |     id: MaybeRefOrGetter<string | undefined>, | ||||||
|  |     full: MaybeRefOrGetter<boolean> = true | ||||||
|  | ): UseQueryReturnType<StudentsResponse, Error> { | ||||||
|  |     return useQuery({ | ||||||
|  |         queryKey: computed(() => classAssignmentsKey(toValue(id)!)), | ||||||
|  |         queryFn: async () => classController.getAssignments(toValue(id)!, toValue(full)!), | ||||||
|  |         enabled: () => Boolean(toValue(id)), | ||||||
|  |     }); | ||||||
| } | } | ||||||
		Reference in a new issue
	
	 Adriaan Jacquet
						Adriaan Jacquet