I have the following Vue methods. When clicking on the edit button, onEditUserPermissions
is called. That function also fetches this.fetchUserPermissions
. The request does finish, and a response is received.
methods:{
onEditUserPermissions(item){
this.userCheckbox = true
let user = item.id
this.selectedUser = item.id;
this.fetchUserPermissions(user)
for (let x of this.assignedUserPermissions){
console.log('assigned',x.id)
this.selectedUserItems.push(x.id)
}
this.editedIndex = 'users'
this.dialog = true
},
fetchUserPermissions(user){
this.$axios.get('/permissions/assigned/user/'+user)
.then(res => {
this.assignedUserPermissions = res.data
})
},
}
When I first click, the for of
loop doesnt work, it doesnt iterate, however, when clicked again, it works. I may be too close to the project but can anyone tell why?