OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/assets/javascripts/angular/services/project-service.js

33 lines
825 B

angular.module('openproject.services')
.service('ProjectService', ['$http', 'PathHelper', function($http, PathHelper) {
var ProjectService = {
getProject: function(projectIdentifier) {
var url = PathHelper.apiV3ProjectPath(projectIdentifier);
return ProjectService.doQuery(url);
},
getProjects: function() {
var url = PathHelper.apiV3ProjectsPath();
return ProjectService.doQuery(url);
},
getSubProjects: function(projectIdentifier) {
var url = PathHelper.apiProjectSubProjectsPath(projectIdentifier);
return ProjectService.doQuery(url);
},
doQuery: function(url, params) {
return $http.get(url, { params: params })
.then(function(response){
return response.data.projects;
});
}
};
return ProjectService;
}]);