mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
load folders from it's api
This commit is contained in:
parent
acf124c81e
commit
22ab5d334e
@ -90,7 +90,7 @@ angular
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: encryptedFolder.Id,
|
id: encryptedFolder.Id,
|
||||||
name: _service.decryptProperty(encryptedFolder.Data.Name, null, false)
|
name: _service.decryptProperty(encryptedFolder.Name, null, false)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,34 +2,41 @@
|
|||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
|
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
|
||||||
cipherService) {
|
cipherService, $q) {
|
||||||
$scope.logins = [];
|
$scope.logins = [];
|
||||||
$scope.folders = [];
|
$scope.folders = [];
|
||||||
|
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
$scope.$on('$viewContentLoaded', function () {
|
|
||||||
apiService.ciphers.list({}, function (ciphers) {
|
|
||||||
$scope.loading = false;
|
|
||||||
|
|
||||||
var decLogins = [];
|
$scope.$on('$viewContentLoaded', function () {
|
||||||
|
var folderPromise = apiService.folders.list({}, function (folders) {
|
||||||
var decFolders = [{
|
var decFolders = [{
|
||||||
id: null,
|
id: null,
|
||||||
name: '(none)'
|
name: '(none)'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
for (var i = 0; i < folders.Data.length; i++) {
|
||||||
|
var decFolder = cipherService.decryptFolderPreview(folders.Data[i]);
|
||||||
|
decFolders.push(decFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.folders = decFolders;
|
||||||
|
}).$promise;
|
||||||
|
|
||||||
|
var cipherPromise = apiService.ciphers.list({}, function (ciphers) {
|
||||||
|
var decLogins = [];
|
||||||
|
|
||||||
for (var i = 0; i < ciphers.Data.length; i++) {
|
for (var i = 0; i < ciphers.Data.length; i++) {
|
||||||
if (ciphers.Data[i].Type === 0) {
|
if (ciphers.Data[i].Type === 1) {
|
||||||
var decFolder = cipherService.decryptFolderPreview(ciphers.Data[i]);
|
|
||||||
decFolders.push(decFolder);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var decLogin = cipherService.decryptLoginPreview(ciphers.Data[i]);
|
var decLogin = cipherService.decryptLoginPreview(ciphers.Data[i]);
|
||||||
decLogins.push(decLogin);
|
decLogins.push(decLogin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.folders = decFolders;
|
|
||||||
$scope.logins = decLogins;
|
$scope.logins = decLogins;
|
||||||
|
}).$promise;
|
||||||
|
|
||||||
|
$q.all([folderPromise, cipherPromise]).then(function () {
|
||||||
|
$scope.loading = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user