diff --git a/application/controllers/api/frontend/v1/stv/Address.php b/application/controllers/api/frontend/v1/stv/Address.php
new file mode 100644
index 000000000..7685fcd04
--- /dev/null
+++ b/application/controllers/api/frontend/v1/stv/Address.php
@@ -0,0 +1,66 @@
+.
+ */
+
+if (! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+ * This controller operates between (interface) the JS (GUI) and the back-end
+ * Provides data to the ajax get calls about addresses
+ * This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
+ */
+class Address extends FHCAPI_Controller
+{
+ public function __construct()
+ {
+ parent::__construct([
+ 'getNations' => self::PERM_LOGGED,
+ 'getPlaces' => self::PERM_LOGGED
+ ]);
+ }
+
+ public function getNations()
+ {
+ $this->load->model('codex/Nation_model', 'NationModel');
+
+ $this->NationModel->addOrder('kurztext');
+
+ $result = $this->NationModel->load();
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+
+ public function getPlaces($plz)
+ {
+ $this->load->model('codex/Gemeinde_model', 'GemeindeModel');
+
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_data(['address.plz' => $plz]);
+
+ $this->form_validation->set_rules('address.plz', 'PLZ', 'numeric|less_than[10000]');
+
+ if (!$this->form_validation->run())
+ $this->terminateWithValidationErrors($this->form_validation->error_array());
+
+ $result = $this->GemeindeModel->getGemeindeByPlz($plz);
+ $data = $this->getDataOrTerminateWithError($result);
+
+ $this->terminateWithSuccess($data);
+ }
+}
diff --git a/application/controllers/components/stv/Address.php b/application/controllers/components/stv/Address.php
deleted file mode 100644
index c0e34c0c3..000000000
--- a/application/controllers/components/stv/Address.php
+++ /dev/null
@@ -1,47 +0,0 @@
-load->model('codex/Nation_model', 'NationModel');
-
- $this->NationModel->addOrder('kurztext');
-
- $result = $this->NationModel->load();
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-
- public function getPlaces($plz)
- {
- $this->load->model('codex/Gemeinde_model', 'GemeindeModel');
-
- $this->load->library('form_validation');
-
- $this->form_validation->set_data(['address.plz' => $plz]);
-
- $this->form_validation->set_rules('address.plz', 'PLZ', 'numeric|less_than[10000]');
-
- if ($this->form_validation->run() == false) {
- $this->output->set_status_header(REST_Controller::HTTP_BAD_REQUEST);
- return $this->outputJsonError($this->form_validation->error_array());
- }
-
- $result = $this->GemeindeModel->getGemeindeByPlz($plz);
- if (isError($result)) {
- $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
- }
- $this->outputJson($result);
- }
-}
diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js
index 05a84499d..2fe6c9713 100644
--- a/public/js/components/Stv/Studentenverwaltung.js
+++ b/public/js/components/Stv/Studentenverwaltung.js
@@ -21,7 +21,6 @@ import StvVerband from "./Studentenverwaltung/Verband.js";
import StvList from "./Studentenverwaltung/List.js";
import StvDetails from "./Studentenverwaltung/Details.js";
import StvStudiensemester from "./Studentenverwaltung/Studiensemester.js";
-import {CoreRESTClient} from '../../RESTClient.js';
export default {
@@ -107,25 +106,20 @@ export default {
this.studiengangKz = studiengang_kz;
this.$refs.stvList.updateUrl(link);
},
- searchfunction(searchsettings) {
- return Vue.$fhcapi.Search.search(searchsettings);
- },
studiensemesterChanged(v) {
this.studiensemesterKurzbz = v;
this.$refs.stvList.updateUrl();
this.$refs.details.reload();
},
reloadList() {
- console.log('reloadList2');
this.$refs.stvList.reload();
}
},
created() {
- CoreRESTClient
- .get('components/stv/Address/getNations')
- .then(result => CoreRESTClient.getData(result.data) || [])
+ this.$fhcApi
+ .get('api/frontend/v1/stv/address/getNations')
.then(result => {
- this.lists.nations = result;
+ this.lists.nations = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
this.$fhcApi
@@ -187,7 +181,7 @@ export default {