importing the api calls in the component and creating api endpoints for the cis profile page

This commit is contained in:
Simon Gschnell
2023-11-15 13:49:06 +01:00
parent 9227cc12f0
commit 7c229bbcee
6 changed files with 127 additions and 32 deletions
+3 -12
View File
@@ -1,8 +1,5 @@
import Profil from "../../components/Cis/Profil/Profil.js";
import fhcapifactory from "../api/fhcapifactory.js";
Vue.$fhcapi = fhcapifactory;
const app = Vue.createApp({
components: {
@@ -10,18 +7,12 @@ const app = Vue.createApp({
},
data() {
return {
stunden: [],
events: null
}
},
methods: {
testsearch: function() {
return Vue.$fhcapi.UserData.getUser();
},
testsearch2: function() {
return Vue.$fhcapi.UserData.getUser2("ma0594");
}
},
});
app.mount('#content');
app.mount('#content');
+11
View File
@@ -5,6 +5,17 @@ export default {
+ 'Cis/Profil/getUser';
return axios.get(url);
},
isMitarbeiterOrStudent: function(uid) {
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
+ `Cis/Profil/isMitarbeiterOrStudent/${uid}`;
return axios.get(url);
},
getPersonInformation: function(uid) {
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
+ `Cis/Profil/getPersonInformation/${uid}`;
return axios.get(url);
},
getUser2: function(uid) {
const url = FHC_JS_DATA_STORAGE_OBJECT.app_root
+ 'models/person/Benutzer_model/getFromPersonId';
+33 -12
View File
@@ -1,29 +1,50 @@
import fhcapifactory from "../../../apps/api/fhcapifactory.js";
export default {
data: function() {
return {
person: null,
person_info: null,
role: null,
}
},
//? this prop was passed in the Profil.php view file
props:['uid','pid'],
methods: {
testsearch: function() {
}
},
created(){
this.$parent.testsearch().then((res) => {
this.person = res.data;
});
},
},
computed:{
cis_profil_info(){
return {
anrede:this.person_info.anrede,
titelpre:this.person_info.titelpre,
titelpost:this.person_info.titelpost,
vorname:this.person_info.vorname,
nachname:this.person_info.nachname,
gebdatum:this.person_info.gebdatum,
gebort:this.person_info.gebort,
};
}
},
created(){
fhcapifactory.UserData.getUser().then(res => this.person = res.data);
fhcapifactory.UserData.isMitarbeiterOrStudent(this.uid).then(res => this.role = res.data);
fhcapifactory.UserData.getPersonInformation(this.pid).then(res => this.person_info = res.data);
},
template: `
<div>
<h1>test</h1>
<code>{{JSON.stringify(person)}}</code>
<p>{{"here is the uid "+uid}} </p>
<p>{{"here is the pid "+pid}} </p>
<code style="color:purple">{{JSON.stringify(cis_profil_info)}}</code>
<!--<code style="color:purple">{{JSON.stringify(person_info)}}</code>-->
<br/>
<code style="color:red">{{JSON.stringify(person)}}</code>
<br/>
<code>{{JSON.stringify(role)}}</code>
</div>
`,
};