Fix a bug where overriding access would keep the entry marked as loading
@@ -255,19 +255,9 @@ let manageAccessCmp = new Vue({
return;
}
- let index = -1;
-
- // Check if this user already has any access and get its index in the array
- for (let i = 0; i < vue.users.length; i++) {
- if (vue.users[i].id === targetUserId) {
- index = i;
- break;
- }
- }
-
+ if (resp.status === "success") {
if (index >= 0) {
// An entry was found, update the data
- let user = vue.users[index];
user.access = resp.privilege_granted;
user.loading = false;
vue.users.splice(index, 1, user);
@@ -299,7 +289,12 @@ let manageAccessCmp = new Vue({
vue.users.push(newUserAccess);
}
-
+ }
+ else {
+ vue.error = resp.error_msg;
+ user.loading = false;
+ vue.users.splice(index, 1, user);
+ }
vue.isProcessing = false;
});
},
