2017-03-10 04:08:47 +01:00
|
|
|
|
angular
|
|
|
|
|
.module('bit.organization')
|
|
|
|
|
|
|
|
|
|
.controller('organizationSubvaultsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
|
|
|
|
|
$analytics) {
|
2017-04-26 16:32:14 +02:00
|
|
|
|
$analytics.eventTrack('organizationSubvaultsAddController', { category: 'Modal' });
|
|
|
|
|
|
2017-03-10 04:08:47 +01:00
|
|
|
|
$scope.submit = function (model) {
|
|
|
|
|
var subvault = cipherService.encryptSubvault(model, $state.params.orgId);
|
|
|
|
|
$scope.submitPromise = apiService.subvaults.post({ orgId: $state.params.orgId }, subvault, function (response) {
|
|
|
|
|
$analytics.eventTrack('Created Subvault');
|
|
|
|
|
var decSubvault = cipherService.decryptSubvault(response, $state.params.orgId, true);
|
|
|
|
|
$uibModalInstance.close(decSubvault);
|
|
|
|
|
}).$promise;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$scope.close = function () {
|
|
|
|
|
$uibModalInstance.dismiss('cancel');
|
|
|
|
|
};
|
|
|
|
|
});
|