1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

do api calls on viewContentLoaded

This commit is contained in:
Kyle Spearrin
2017-03-07 00:36:27 -05:00
parent 22299c03cd
commit 3d273f041e
4 changed files with 47 additions and 40 deletions

View File

@@ -8,28 +8,30 @@
email: null
};
apiService.accounts.getProfile({}, function (user) {
$scope.model = {
profile: {
name: user.Name,
masterPasswordHint: user.MasterPasswordHint,
culture: user.Culture
},
email: user.Email,
twoFactorEnabled: user.TwoFactorEnabled
};
$scope.$on('$viewContentLoaded', function () {
apiService.accounts.getProfile({}, function (user) {
$scope.model = {
profile: {
name: user.Name,
masterPasswordHint: user.MasterPasswordHint,
culture: user.Culture
},
email: user.Email,
twoFactorEnabled: user.TwoFactorEnabled
};
if (user.Organizations) {
var orgs = [];
for (var i = 0; i < user.Organizations.length; i++) {
orgs.push({
id: user.Organizations[i].Id,
name: user.Organizations[i].Name
});
if (user.Organizations) {
var orgs = [];
for (var i = 0; i < user.Organizations.length; i++) {
orgs.push({
id: user.Organizations[i].Id,
name: user.Organizations[i].Name
});
}
$scope.model.organizations = orgs;
}
$scope.model.organizations = orgs;
}
});
});
$scope.generalSave = function () {