feat: frontend klas controller aangemaakt
This commit is contained in:
parent
c6aea229f0
commit
eb8ac9c3bb
1 changed files with 33 additions and 0 deletions
33
frontend/src/controllers/classes.ts
Normal file
33
frontend/src/controllers/classes.ts
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import { BaseController } from "./base-controller";
|
||||||
|
|
||||||
|
|
||||||
|
export class ClassController extends BaseController {
|
||||||
|
constructor() {
|
||||||
|
super("class");
|
||||||
|
}
|
||||||
|
|
||||||
|
getAll(full = true) {
|
||||||
|
return this.get<{ classes: any[] }>(`/`, { full });
|
||||||
|
}
|
||||||
|
|
||||||
|
getById(id: string) {
|
||||||
|
return this.get<{ class: any }>(`/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
createClass(data: any) {
|
||||||
|
return this.post<{ class: any }>(`/`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteClass(id: string) {
|
||||||
|
return this.delete<{ class: any }>(`/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getStudents(id: string, full = true) {
|
||||||
|
return this.get<{ students: any[] }>(`/${id}/students`, { full });
|
||||||
|
}
|
||||||
|
|
||||||
|
getTeacherInvitations(id: string, full = true) {
|
||||||
|
return this.get<{ invitations: any[] }>(`/${id}/teacher-invitations`, { full });
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue