diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index 28e7ec3..ec9e8bf 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -109,8 +109,8 @@ module.exports = function (ctx) { }, env: ctx.dev ? { // Base URL for API-Calls: DEV - //API: JSON.stringify('http://localhost:8080') - API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'), + //API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching') + API: JSON.stringify('http://localhost:8080'), USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement') } : { // Base URL for API-Calls: PRODUCTION (build) diff --git a/frontend/src/pages/Profile.vue b/frontend/src/pages/Profile.vue index 9b1af06..e8e61f2 100644 --- a/frontend/src/pages/Profile.vue +++ b/frontend/src/pages/Profile.vue @@ -35,7 +35,7 @@
- + @@ -50,7 +50,7 @@ - @@ -298,15 +298,8 @@ this.data[0].userData = this.userName; this.email = JSON.parse(localStorage.getItem('userMail')); this.data[1].userData = this.email; - this.userRanking = 1234; - this.data[2].userData = this.userRanking; + //this.getPersonalRanking(); this.getTeamData(); - this.teamName = "BuGa19Community"; - this.data[3].userData = this.teamName; - this.dropDownSelectedItem = this.teamName; - this.teamRanking = 2019; - this.data[4].userData = this.teamRanking; - this.currentTeamStatus = "Dienstag 15:00 Treffen zum Blumencache"; }, methods: { validateEmail(email) { @@ -314,25 +307,45 @@ return re.test(String(email).toLowerCase()); }, getPersonalRanking() { - let token = JSON.parse(localStorage.getItem('userToken')).token; - this.$axios.get('/api/getRankingPlace', {token}) + let token; + if (localStorage.getItem('userToken')) { + token = JSON.parse(localStorage.getItem('userToken')).token; + } else { + return; + } + this.$axios.get('/api/getRankingPlace', {params: {token}}) .then((response) => { this.userRanking = response.data; console.log(response.data); + this.data[2].userData = this.userRanking; }).catch((error) => { this.handleError(error); }) }, getTeamData() { - let token = JSON.parse(localStorage.getItem('userToken')).token; - this.$axios.get('/api/getTeamOfUser', {token}) + let token; + if (localStorage.getItem('userToken')) { + token = JSON.parse(localStorage.getItem('userToken')).token; + } else { + return; + } + this.$axios.get('/api/getTeamOfUser', {params: {token}}) .then(response => { - this.teamName = response.data; - if (this.teamName.length >= 3) { + if (response.data.trim() === '') { + this.boolAlreadyInTeam = false; + this.teamName = "Aktuell in keinem Team"; + this.currentTeamStatus = ""; + this.teamRanking = "-"; + } else { this.boolAlreadyInTeam = true; + this.teamName = response.data; + this.currentTeamStatus = response.data.teamStatus; + this.teamRanking = response.data.teamRanking; } + this.data[3].userData = this.teamName; + this.dropDownSelectedItem = this.teamName; + this.data[4].userData = this.teamRanking; console.log("getTeam: " + response); - this.currentTeamStatus = response.data.teamStatus; }).catch((error) => { this.handleError(error); }) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index abd7b33..526b675 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -1041,6 +1041,7 @@ public class Controller { @ApiResponse(code = 401, message = "JWT Token expired"), @ApiResponse(code = 400, message = "Something went wrong at verification") }) + @CrossOrigin(origins = "http://localhost:8081") // only for dev purpose @RequestMapping(value = "/api/getTeamOfUser", method = RequestMethod.GET, produces = "application/json") public ResponseEntity getTeamOfUser(@RequestParam String token){