replace Observable.throw to observableThrowError to avoid undefined error

Signed-off-by: Meina Zhou <meinaz@vmware.com>
This commit is contained in:
Meina Zhou 2018-10-10 15:05:41 +08:00
parent 081921cf89
commit 1487b649ff

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs';
import { throwError as observableThrowError, Observable } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
@ -15,34 +15,34 @@ export class GcApiRepository {
public postSchedule(param): Observable<any> {
return this.http.post("/api/system/gc/schedule", param)
.pipe(catchError(err => Observable.throw(err)));
.pipe(catchError(error => observableThrowError(error)));
}
public putSchedule(param): Observable<any> {
return this.http.put("/api/system/gc/schedule", param)
.pipe(catchError(err => Observable.throw(err)));
.pipe(catchError(error => observableThrowError(error)));
}
public getSchedule(): Observable<any> {
return this.http.get("/api/system/gc/schedule")
.pipe(catchError(err => Observable.throw(err)))
.pipe(catchError(error => observableThrowError(error)))
.pipe(map(response => response.json()));
}
public getLog(id): Observable<any> {
return this.http.get("/api/system/gc/" + id + "/log")
.pipe(catchError(err => Observable.throw(err)));
.pipe(catchError(error => observableThrowError(error)));
}
public getStatus(id): Observable<any> {
return this.http.get("/api/system/gc/" + id)
.pipe(catchError(err => Observable.throw(err)))
.pipe(catchError(error => observableThrowError(error)))
.pipe(map(response => response.json()));
}
public getJobs(): Observable<any> {
return this.http.get("/api/system/gc")
.pipe(catchError(err => Observable.throw(err)))
.pipe(catchError(error => observableThrowError(error)))
.pipe(map(response => response.json()));
}