Stop removing previous assignments

The assignments are now removed through the server. No need to do this via JS anymore
This commit is contained in:
Lukas Hirt
2020-07-31 14:54:12 +02:00
committed by Benedikt Kulmann
parent ee047d8739
commit b65c6925ed

View File

@@ -57,8 +57,7 @@ export default {
data () {
return {
currentRole: null,
currentAssignment: null
currentRole: null
}
},
@@ -81,25 +80,6 @@ export default {
methods: {
changeRole (roleId) {
this.removeAssignment().then(() => this.addAssignment(roleId))
},
removeAssignment () {
if (this.currentAssignment === null) {
return Promise.resolve()
}
return fetch(`${this.configuration.server}/api/v0/settings/assignments-remove`, {
method: 'POST',
mode: 'cors',
headers: this.headers,
body: JSON.stringify({
id: this.currentAssignment.id
})
})
},
addAssignment (roleId) {
fetch(`${this.configuration.server}/api/v0/settings/assignments-add`, {
method: 'POST',
mode: 'cors',
@@ -129,7 +109,6 @@ export default {
return
}
this.currentAssignment = assignedRole.assignments[0]
this.currentRole = this.roles.find(role => {
return role.id === assignedRole.assignments[0].roleId
})