mirror of https://github.com/portainer/portainer
fix(secrets): fix an issue when removing a secret that is in use (#984)
parent
7473681c5b
commit
6d6f4f092d
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue