Skip to content

Commit 34acdea

Browse files
authored
Merge pull request #138 from marc101101/feature/highlighted-courses
Highlighted courses are now available
2 parents 1a4a767 + b7b0d15 commit 34acdea

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

client/app/components/home/courses/courses.component.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export class CoursesComponent implements OnInit {
3737
if(params.id == "me"){
3838
this.requestCoursesByUser();
3939
}
40+
if(params.id == "highlights"){
41+
this.requestCoursesByHighlights();
42+
}
4043
else{
4144
this.requestCoursesByCategory(params.id);
4245
}
@@ -71,4 +74,16 @@ export class CoursesComponent implements OnInit {
7174
});
7275
}
7376

77+
requestCoursesByHighlights():void{
78+
this.headerText = "Highlights";
79+
this.courses = [];
80+
this.coursesService.getCoursesByHighlight().subscribe(response =>{
81+
this.courses.push(response);
82+
if(response.name != "HttpResponseError"){
83+
this.dataIsAvailable = true;
84+
this.courses = response;
85+
}
86+
});
87+
}
88+
7489
}

client/app/components/home/shared/courses.service.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ export class CoursesService {
3535
);
3636
}
3737

38+
getCoursesByHighlight(): Observable<any>{
39+
return this.http.get(this.url + "/courses/highlights", this.httpOptions).pipe(
40+
map((res: Response) => {
41+
return res;
42+
}),
43+
catchError((err: HttpErrorResponse) => {
44+
this.alertService.push(err);
45+
return of(err);
46+
})
47+
);
48+
}
49+
3850
applyToCourse(courseId: String): Observable<any>{
3951
return this.http.post(this.url + "/courses/" + courseId + "/apply", "" ,this.httpOptions).pipe(
4052
map((res: Response) => {

client/app/components/home/shared/menu/menu.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
Kurs Kategorien
2323
</div>
2424

25-
<div class="menuPoint" [routerLink]="['aktuelles']" (click)="routing()">
25+
<div class="menuPoint" [routerLink]="['kurs-uebersicht/highlights']" (click)="routing()">
2626
<span class="icon">
2727
<i class="fa fa-calendar"></i>
2828
</span>
29-
Aktuelles
29+
Highlights
3030
</div>
3131

3232
<div class="menuPoint" [routerLink]="['kontakt']" (click)="routing()">

0 commit comments

Comments
 (0)