1
0

Updating a team/user right now uses the new update method

This commit is contained in:
kolaente
2018-09-19 20:41:53 +02:00
parent 65cd505059
commit f1d48fd47c
3 changed files with 27 additions and 8 deletions

View File

@ -160,10 +160,19 @@
})
},
toggleTeamType(teamid, current) {
this.teamToDelete = teamid
this.newTeam.team_id = teamid
this.deleteTeam()
this.addTeam(!current)
let right = 0
if (!current) {
right = 2
}
HTTP.post(this.typeString + `s/` + this.id + `/teams/` + teamid, {right: right}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
.then(() => {
this.loadTeams()
this.handleSuccess({message: 'The team right was successfully updated.'})
})
.catch(e => {
this.handleError(e)
})
},
handleError(e) {
this.loading = false

View File

@ -162,10 +162,19 @@
})
},
toggleUserType(userid, current) {
this.userToDelete = userid
this.newUser.user_id = userid
this.deleteUser()
this.addUser(!current)
let right = 0
if (!current) {
right = 2
}
HTTP.post(this.typeString + `s/` + this.id + `/users/` + userid, {right: right}, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
.then(() => {
this.loadUsers()
this.handleSuccess({message: 'The user right was successfully updated.'})
})
.catch(e => {
this.handleError(e)
})
},
handleError(e) {
this.loading = false