Angular 2 - Argument type RequestOptions is not assignable to parameter type RequestOptions

940 views Asked by At

I try to create cutom Http class to hadle 401 error globaly. I have error when call super constructor - Argument type RequestOptions is not assignable to parameter type RequestOptions.

Here is my code:

@Injectable()
export class HttpService extends Http {
  private baseUrl: string;

  constructor(baseUrl: string, backend: ConnectionBackend, options: RequestOptions) {
    this.baseUrl = baseUrl;
    super(backend, options); // <- Error here
  }

  get(url: string, options?: RequestOptionsArgs): Observable<Response> {
    console.log('get...');
    return super.get(this.baseUrl.concat(url), options).catch(this.handleError);
  }

  private handleError(error: Response | any) {
    console.log(error['status']);

    return Observable.throw(error);
  }
}
0

There are 0 answers