fix: student join req by class route + teacher return post put delete + status
This commit is contained in:
parent
c0995d3933
commit
912369f87e
9 changed files with 106 additions and 47 deletions
|
@ -45,6 +45,10 @@ export class StudentController extends BaseController {
|
|||
return this.get<{ requests: any[] }>(`/${username}/joinRequests`);
|
||||
}
|
||||
|
||||
getJoinRequest(username: string, classId: string) {
|
||||
return this.get<{ request: any[] }>(`/${username}/joinRequests/${classId}`);
|
||||
}
|
||||
|
||||
createJoinRequest(username: string, classId: string) {
|
||||
return this.post(`/${username}/joinRequests}`, classId);
|
||||
}
|
||||
|
|
|
@ -121,6 +121,17 @@ export function useStudentJoinRequestsQuery(username: MaybeRefOrGetter<string |
|
|||
});
|
||||
}
|
||||
|
||||
export function useStudentJoinRequestQuery(
|
||||
username: MaybeRefOrGetter<string | undefined>,
|
||||
classId: MaybeRefOrGetter<string | undefined>,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: computed(() => STUDENT_JOIN_REQUESTS_QUERY_KEY(toValue(username)!)),
|
||||
queryFn: () => studentController.getJoinRequest(toValue(username)!, toValue(classId)!),
|
||||
enabled: () => Boolean(toValue(username)),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutation to create a join request for a class
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue