inviteToTeam finished

This commit is contained in:
rchrist 2019-05-09 18:02:53 +02:00
parent 75f794da23
commit 45515d33e0
3 changed files with 38 additions and 16 deletions

View File

@ -57,7 +57,8 @@
<q-avatar icon="add" color="primary" text-color="white"/>
</q-item-section>
<q-item-section>
<q-item-label>Neues Team erstellen</q-item-label>
<q-item-label v-show="!boolAlreadyInTeam">Neues Team erstellen</q-item-label>
<q-item-label v-show="boolAlreadyInTeam">Neues Team erstellen<br/>(Team verlassen um Option zu nutzen)</q-item-label>
</q-item-section>
</q-item>
</q-list>
@ -164,6 +165,7 @@
inviteMail: "",
currentTeamStatus: "",
teamStatus: "",
userName: "",
email: null,
userRanking: null,
teamName: null,
@ -192,6 +194,10 @@
}
],
data: [
{
name: 'Benutzername',
userData: this.userName,
},
{
name: 'E-Mail',
userData: this.email,
@ -290,8 +296,10 @@
created: function () {
this.$store.commit('auth/SET_AUTHENTICATED');
this.$store.commit('auth/SET_USER');
this.userName = JSON.parse(localStorage.getItem('userToken')).name;
this.data[0].userData = this.userName;
this.email = JSON.parse(localStorage.getItem('userMail'));
this.data[0].userData = this.email;
this.data[1].userData = this.email;
this.getPersonalRanking();
this.getTeamData();
this.fetchTeamInvites();
@ -302,11 +310,11 @@
return re.test(String(email).toLowerCase());
},
getPersonalRanking() {
let name = this.email;
this.$axios.get('/api/hello', {params: {name}})
let email = this.email;
this.$axios.get('/api/getRankingPlace', {params: {email}})
.then((response) => {
this.userRanking = response.data;
this.data[1].userData = this.userRanking;
this.data[2].userData = this.userRanking;
}).catch((error) => {
this.handleError(error);
})
@ -320,11 +328,12 @@
}
this.$axios.get('/api/getTeamOfUser', {params: {token}})
.then(response => {
if (response.data.name === '') {
if (response.data === '') {
this.boolAlreadyInTeam = false;
this.teamName = "Aktuell in keinem Team";
this.currentTeamStatus = "";
this.teamRanking = "-";
this.dropDownSelectItem('Offene Teameinladungen');
} else {
this.boolAlreadyInTeam = true;
this.teamName = response.data.name;
@ -332,9 +341,9 @@
//this.teamRanking = response.data.teamRanking;
this.fetchTeamMembers();
}
this.data[2].userData = this.teamName;
this.data[3].userData = this.teamName;
this.dropDownSelectedItem = this.teamName;
this.data[3].userData = this.teamRanking;
this.data[4].userData = this.teamRanking;
console.log("getTeam: " + response);
}).catch((error) => {
this.handleError(error);
@ -398,8 +407,8 @@
}
this.$axios.get('/api/getMyTeamInvites', {params: {token}})
.then((response) => {
console.log(response.data);
this.teamInvites = response.data;
console.log(this.teamInvites);
}).catch((error) => {
this.handleError(error);
})
@ -445,16 +454,20 @@
})
},
sendTeamInvite() {
let params;
let params = {};
if (localStorage.getItem('userToken')) {
params.token = JSON.parse(localStorage.getItem('userToken')).token;
} else {
return;
}
params.invitedUserEmail = this.inviteMail;
this.$axios.post('/api/sendTeamInvite', {params: {params}})
this.$axios.post('/api/sendTeamInvite', null, {params})
.then((response) => {
console.log(response.data);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {
message: "Du hast " + params.invitedUserEmail + " eingeladen!",
title: "Einladung ins Team",
color: "blue"
});
}).catch((error) => {
this.handleError(error);
})
@ -469,7 +482,6 @@
params.teamStatus = this.teamStatus;
this.$axios.put('/api/setTeamStatus', null, {params})
.then((response) => {
console.log(response.data);
this.getTeamData();
}).catch((error) => {
this.handleError(error);

View File

@ -3,6 +3,14 @@
<form class="register" autocomplete="off">
<div class="q-pa-md">
<div class="column q-gutter-lg" style="">
<div class="col">
<div class="">
<div class="" style="max-width: 440px">
<q-input lazy-rules outlined filled stack-label v-model="user.name" type="text" label="Benutzername"
:rules="[val=>val.length>=2||'Name muss mindestens 2 Zeichen lang sein!']"/>
</div>
</div>
</div>
<div class="col">
<div class="">
<div class="" style="max-width: 440px">
@ -63,6 +71,7 @@
data() {
return {
user: {
name: "",
email: "",
checkemail: "",
password: "",
@ -72,7 +81,8 @@
},
computed: {
validationSuccesful() {
if (this.validateEmail(this.user.email)
if (this.user.name >= 2
&& this.validateEmail(this.user.email)
&& this.user.email === this.user.checkemail
&& this.user.password.length >= 8
&& this.user.password === this.user.checkpassword) {
@ -93,7 +103,7 @@
if (this.user.email === this.user.checkemail && this.user.password === this.user.checkpassword) {
const data = {
name: this.user.email,
name: this.user.name,
password: this.user.password,
email: this.user.email,
roles: [

View File

@ -950,7 +950,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
@CrossOrigin(origins = "*", allowedHeaders = "*") // only for dev purpose
@RequestMapping(value = "/api/getRankingPlace", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity getRankingPlace(@RequestParam String email) {
return ResponseEntity.status(200).body(userRepository.getRankingPlaceFromUser(email));