ClassroomLeaders.js 882 B

12345678910111213141516171819202122232425262728293031
  1. import { appApi } from 'src/boot/axios.js'
  2. import APIRepository from '../classes/APIRepository.js'
  3. export default class ClassroomLeaderAPI extends APIRepository {
  4. constructor() {
  5. super('classroom_leaders', appApi, '/lma/classroom_leaders')
  6. this.APIAdresses = {
  7. base: '/lma/classroom_leaders',
  8. byId: (id) => '/lma/classroom_leaders/' + id,
  9. withLastPassedUnit: '/lma/classroom_leaders/leaders_with_last_passed_unit'
  10. }
  11. this.CacheList = {
  12. base: this.name + this.APIAdresses.base,
  13. byId: (id) => this.name + this.APIAdresses.byId(id)
  14. }
  15. }
  16. deleteById (id) {
  17. return this.sendRequest({
  18. apiMethod: 'delete',
  19. api: this.api,
  20. request: this.APIAdresses.byId(id),
  21. resolveCallback: (response) => {
  22. return response.data
  23. },
  24. rejectCallback: (error) => {
  25. return error
  26. }
  27. })
  28. }
  29. }