1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-10 06:08:34 +02:00
bitwarden-browser/src/app/organization/organizationCollectionsAddController.js
2017-04-27 09:35:21 -04:00

21 lines
916 B
JavaScript

angular
.module('bit.organization')
.controller('organizationCollectionsAddController', function ($scope, $state, $uibModalInstance, apiService, cipherService,
$analytics) {
$analytics.eventTrack('organizationCollectionsAddController', { category: 'Modal' });
$scope.submit = function (model) {
var collection = cipherService.encryptCollection(model, $state.params.orgId);
$scope.submitPromise = apiService.collections.post({ orgId: $state.params.orgId }, collection, function (response) {
$analytics.eventTrack('Created Collection');
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
$uibModalInstance.close(decCollection);
}).$promise;
};
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
});