mirror of https://github.com/portainer/portainer
27 lines
680 B
JavaScript
27 lines
680 B
JavaScript
angular.module('portainer.services')
|
|
.factory('DockerHubService', ['$q', 'DockerHub', function DockerHubServiceFactory($q, DockerHub) {
|
|
'use strict';
|
|
var service = {};
|
|
|
|
service.dockerhub = function() {
|
|
var deferred = $q.defer();
|
|
|
|
DockerHub.get().$promise
|
|
.then(function success(data) {
|
|
var dockerhub = new DockerHubViewModel(data);
|
|
deferred.resolve(dockerhub);
|
|
})
|
|
.catch(function error(err) {
|
|
deferred.reject({ msg: 'Unable to retrieve DockerHub details', err: err });
|
|
});
|
|
|
|
return deferred.promise;
|
|
};
|
|
|
|
service.update = function(dockerhub) {
|
|
return DockerHub.update({}, dockerhub).$promise;
|
|
};
|
|
|
|
return service;
|
|
}]);
|