diff --git a/application/controllers/api/frontend/v1/Lehre.php b/application/controllers/api/frontend/v1/Lehre.php index 95422142d..a36b673b4 100644 --- a/application/controllers/api/frontend/v1/Lehre.php +++ b/application/controllers/api/frontend/v1/Lehre.php @@ -57,6 +57,11 @@ class Lehre extends FHCAPI_Controller $studentenMails = $this->getDataOrTerminateWithError($studentenMails); + //convert array of objects into array of strings + $studentenMails = array_map(function($element){ + return $element->mail; + }, $studentenMails); + $this->terminateWithSuccess($studentenMails); } diff --git a/public/js/components/Cis/Mylv/LvUebersicht.js b/public/js/components/Cis/Mylv/LvUebersicht.js index 1a5a3525d..503791404 100644 --- a/public/js/components/Cis/Mylv/LvUebersicht.js +++ b/public/js/components/Cis/Mylv/LvUebersicht.js @@ -15,6 +15,7 @@ export default { lehreinheit:null, stg:null, lv:null, + emailAnStudierende:null, result: false, } @@ -26,11 +27,11 @@ export default { }, methods:{ showModal: function(){ - this.$fhcApi.factory.lehre.getStudentenMail(this.event.lehreinheit_id).then(res => - { - console.log(res.data,"API response"); - }); + { + // prepare the mailto link with all the emails from the students of the lv + this.emailAnStudierende = "mailto:"+res.data.join(","); + }); }, }, mounted(){ @@ -40,7 +41,9 @@ export default { template:/*html*/`