Get Projects

This commit is contained in:
annampak 2017-10-17 16:20:40 +03:00
parent a4fee58983
commit 5863ad4e16
2 changed files with 34 additions and 13 deletions

View File

@ -35,7 +35,21 @@ export class ProjectsComponent implements OnInit{
}
ngOnInit() {
this.projects = this.serverService.getDummyProjects()
//this.projects = this.serverService.getDummyProjects();
this.projects = [];
this.serverService.getProjects().subscribe(
response => {
console.log("response");
console.log(response);
response.forEach(resp => {
let pr = new Project();
pr.id = resp.id;
pr.name = resp.label;
this.projects.push(pr);
});
}
);
}

View File

@ -69,22 +69,29 @@ export class ServerService {
}
getDummyProjects(){
let projects :Project[] =[];
getProjects(){
let project = new Project;
project.name = "Project1";
project.id = "Project1Id";
let headers = new HttpHeaders().set("google-token", this.tokenService.getToken());
projects.push(project);
console.log("google-token: "+ this.tokenService.getToken());
let project2 = new Project;
project2.name = "Project2";
project2.id = "Project2Id";
return this.httpClient.get<any>("http://dl010.madgik.di.uoa.gr:8080/dmp-backend-no-sec/rest/project/listAllLabelIDs");
projects.push(project2);
// let projects :Project[] =[];
return projects;
// let project = new Project;
// project.name = "Project1";
// project.id = "Project1Id";
// projects.push(project);
// let project2 = new Project;
// project2.name = "Project2";
// project2.id = "Project2Id";
// projects.push(project2);
// return projects;
}
}