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