portainer/app/services/api/dockerhubService.js

27 lines
680 B
JavaScript
Raw Normal View History

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;
}]);