Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// From its role
const oldRole = oldUserRole.Role;
oldRole.Users.splice(oldRole.Users.indexOf(oldUserRole), 1);
// From current user
this.currentUser.Roles.splice(this.currentUser.Roles.indexOf(oldUserRole), 1);
// And set it detached
oldUserRole.entityAspect.setDetached();
// User id fix-up
this.currentUser.Id = updatedUser.Id;
// Update breeze entities
this.appEntityManager.createEntity("User", updatedUser, EntityState.Unchanged, MergeStrategy.OverwriteChanges);
this.appEntityManager.createEntity("UserRole", updatedUser.Roles[0], EntityState.Unchanged, MergeStrategy.OverwriteChanges);
}
// From its role
const oldRole = oldUserRole.Role;
oldRole.Users.splice(oldRole.Users.indexOf(oldUserRole), 1);
// From current user
this.currentUser.Roles.splice(this.currentUser.Roles.indexOf(oldUserRole), 1);
// And set it detached
oldUserRole.entityAspect.setDetached();
// User id fix-up
this.currentUser.Id = updatedUser.Id;
// Update breeze entities
this.appEntityManager.createEntity("User", updatedUser, EntityState.Unchanged, MergeStrategy.OverwriteChanges);
this.appEntityManager.createEntity("UserRole", updatedUser.Roles[0], EntityState.Unchanged, MergeStrategy.OverwriteChanges);
}