fix: put route frontend + veranderingen delete

This commit is contained in:
Gabriellvl 2025-04-15 17:33:03 +02:00
parent f3d2b3313c
commit ef04f6c7af
4 changed files with 40 additions and 42 deletions

View file

@ -14,15 +14,23 @@ export class TeacherInvitationController extends BaseController {
super("teachers/invitations");
}
async getAll(username: string, by: boolean): Promise<TeacherInvitationsResponse> {
return this.get<TeacherInvitationsResponse>(`/${username}`, { by });
async getAll(username: string, sent: boolean): Promise<TeacherInvitationsResponse> {
return this.get<TeacherInvitationsResponse>(`/${username}`, { sent });
}
async getBy(data: TeacherInvitationData): Promise<TeacherInvitationResponse> {
return this.get<TeacherInvitationResponse>(`/${data.sender}/${data.receiver}/${data.class}`)
}
async create(data: TeacherInvitationData): Promise<TeacherInvitationResponse> {
return this.post<TeacherInvitationResponse>("/", data);
}
async respond(data: TeacherInvitationData, accepted: boolean): Promise<TeacherInvitationResponse> {
return this.delete<TeacherInvitationResponse>(`/${data.sender}/${data.receiver}/${data.class}`, { accepted });
async remove(data: TeacherInvitationData): Promise<TeacherInvitationResponse> {
return this.delete<TeacherInvitationResponse>(`/${data.sender}/${data.receiver}/${data.class}`);
}
async respond(data: TeacherInvitationData) {
return this.put<TeacherInvitationResponse>("/", data);
}
}