I need to wait for this observable to return (simplified):
assembleOptions(options?: RequestOptionsArgs): Observable<boolean> {
let auth = this._cookieService.get(this.auth);
if (auth === undefined || auth === null) {
this._http.get('/someValue').map(x => {
//do something with x
return Observable.of(true);
})
} else {
return Observable.of(true);
}
}
This appears to return an Observable<true>
which doesn't really matter, as I am not using it, I just need to wait for it, then I try to use it within this:
public get(url: string, options?: RequestOptionsArgs): Observable<Response> {
return this.assembleOptions(options).map(x => {
return this._http.get(url, this.options);
});
}
Where this._http
is from
import { Http, Response, Headers, RequestOptionsArgs } from '@angular/http';
Which does not work, it is returning an Observable<Observable<Response>>
Type 'Observable<Observable<Response>> is not assignable to type 'Observable<Response>'
What am I missing here? I have tried casting all over the place to no avail.