diff --git a/src/components/sharing/team.vue b/src/components/sharing/team.vue index 3e3d7c0b8..2f36c615b 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 b87660d39..c8c6a5c2b 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 2f171384b..268fdfa4d 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