fix(secrets): fix an issue when removing a secret that is in use (#984)

pull/997/head
Anthony Lapenna 2017-07-07 15:45:31 +02:00 committed by GitHub
parent 7473681c5b
commit 6d6f4f092d
1 changed files with 15 additions and 1 deletions

View File

@ -36,7 +36,21 @@ angular.module('portainer.services')
};
service.remove = function(secretId) {
return Secret.remove({ id: secretId }).$promise;
var deferred = $q.defer();
Secret.remove({ id: secretId }).$promise
.then(function success(data) {
if (data.message) {
deferred.reject({ msg: data.message });
} else {
deferred.resolve();
}
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to remove secret', err: err });
});
return deferred.promise;
};
service.create = function(secretConfig) {