resolve issues with id on api calls

This commit is contained in:
Kyle Spearrin 2017-05-10 14:20:45 -04:00
parent ea24d72f01
commit e03d4d52c4
4 changed files with 29 additions and 19 deletions

View File

@ -75,9 +75,9 @@
if ($scope.useGroups) {
collection.groupIds = [];
for (var id in $scope.selectedGroups) {
if ($scope.selectedGroups.hasOwnProperty(id)) {
collection.groupIds.push(id);
for (var groupId in $scope.selectedGroups) {
if ($scope.selectedGroups.hasOwnProperty(groupId)) {
collection.groupIds.push(groupId);
}
}
}

View File

@ -88,14 +88,17 @@
if ($scope.useGroups) {
collection.groupIds = [];
for (var id in $scope.selectedGroups) {
if ($scope.selectedGroups.hasOwnProperty(id)) {
collection.groupIds.push(id);
for (var groupId in $scope.selectedGroups) {
if ($scope.selectedGroups.hasOwnProperty(groupId)) {
collection.groupIds.push(groupId);
}
}
}
$scope.submitPromise = apiService.collections.put({ orgId: $state.params.orgId }, collection, function (response) {
$scope.submitPromise = apiService.collections.put({
orgId: $state.params.orgId,
id: id
}, collection, function (response) {
$analytics.eventTrack('Edited Collection');
var decCollection = cipherService.decryptCollection(response, $state.params.orgId, true);
$uibModalInstance.close(decCollection);

View File

@ -67,14 +67,17 @@
if (!group.accessAll) {
group.collectionIds = [];
for (var id in $scope.selectedCollections) {
if ($scope.selectedCollections.hasOwnProperty(id)) {
group.collectionIds.push(id);
for (var collId in $scope.selectedCollections) {
if ($scope.selectedCollections.hasOwnProperty(collId)) {
group.collectionIds.push(collId);
}
}
}
$scope.submitPromise = apiService.groups.put({ orgId: $state.params.orgId }, group, function (response) {
$scope.submitPromise = apiService.groups.put({
orgId: $state.params.orgId,
id: id
}, group, function (response) {
$analytics.eventTrack('Edited Group');
$uibModalInstance.close({
id: response.Id,

View File

@ -84,14 +84,18 @@
}
}
$scope.submitPromise = apiService.organizationUsers.put({ orgId: $state.params.orgId, id: id }, {
type: $scope.type,
collections: collections,
accessAll: $scope.accessAll
}, function () {
$analytics.eventTrack('Edited User');
$uibModalInstance.close();
}).$promise;
$scope.submitPromise = apiService.organizationUsers.put(
{
orgId: $state.params.orgId,
id: id
}, {
type: $scope.type,
collections: collections,
accessAll: $scope.accessAll
}, function () {
$analytics.eventTrack('Edited User');
$uibModalInstance.close();
}).$promise;
};
$scope.close = function () {