Newer
Older
import { HttpClient } from '@angular/common/http';
import { Response } from '@angular/http';
import { throwError, Observable } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { Course } from './models/course';
constructor(private http: HttpClient, private configService: ConfigService) {
this.plannerApiUrl = this.configService.apiPlannerUrl;
getCourseData(): Observable<Course> {
return this.http.get<Course>(this.plannerApiUrl + '/degreePlan/520224/courses')
.pipe(catchError(this.errorHandler));
}
private errorHandler(error: Response) {
return throwError(error || 'Server Error');
}