diff --git a/public/js/api/factory/stv/group.js b/public/js/api/factory/stv/group.js new file mode 100644 index 000000000..b395fbf43 --- /dev/null +++ b/public/js/api/factory/stv/group.js @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2025 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export default { + getGruppen(id) { + return { + method: 'get', + url: 'api/frontend/v1/stv/Gruppen/getGruppen/' + id + }; + }, + deleteGroup(params) { + return { + method: 'post', + url: 'api/frontend/v1/stv/Gruppen/deleteGruppe/', + params + }; + } +} + diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Gruppen/Gruppen.js b/public/js/components/Stv/Studentenverwaltung/Details/Gruppen/Gruppen.js index 6434f9fa8..67f422efb 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Gruppen/Gruppen.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Gruppen/Gruppen.js @@ -1,5 +1,7 @@ import {CoreFilterCmpt} from "../../../../filter/Filter.js"; +import ApiStvGroups from '../../../../../api/factory/stv/group.js'; + export default { name: 'TblGroups', components: { @@ -17,12 +19,9 @@ export default { return { tabulatorOptions: { ajaxURL: 'dummy', - ajaxRequestFunc: this.$fhcApi.factory.stv.group.getGruppen, - ajaxParams: () => { - return { - id: this.student.uid - }; - }, + ajaxRequestFunc: () => this.$api.call( + ApiStvGroups.getGruppen(this.student.uid) + ), ajaxResponse: (url, params, response) => response.data, initialFilter: [ {field: "uid", type: "=", value: this.student.uid}, @@ -130,7 +129,8 @@ export default { gruppe_kurzbz: gruppe_kurzbz }; - return this.$fhcApi.factory.stv.group.deleteGroup(group_id) + return this.$api + .call(ApiStvGroups.deleteGroup(group_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); }).catch(this.$fhcAlert.handleSystemError)