From f1d48fd47c13f7f409c07328f2e04682acd949e7 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 19 Sep 2018 20:41:53 +0200 Subject: [PATCH] Updating a team/user right now uses the new update method --- src/components/sharing/team.vue | 17 +++++++++++++---- src/components/sharing/user.vue | 17 +++++++++++++---- todo.md | 1 + 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/components/sharing/team.vue b/src/components/sharing/team.vue index 3e3d7c0b..2f36c615 100644 --- a/src/components/sharing/team.vue +++ b/src/components/sharing/team.vue @@ -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 diff --git a/src/components/sharing/user.vue b/src/components/sharing/user.vue index b87660d3..c8c6a5c2 100644 --- a/src/components/sharing/user.vue +++ b/src/components/sharing/user.vue @@ -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 diff --git a/todo.md b/todo.md index 2f171384..268fdfa4 100644 --- a/todo.md +++ b/todo.md @@ -52,3 +52,4 @@ * [x] freigeben * [x] entfernen * [x] Einstellmglkt für Rechte +* [x] Den Sharing-Updateshit mit der neuen methode machen (post) \ No newline at end of file