This is mainly an RxJs best practice/approach question, since my POC code works but I\'m brand new to RxJs.
The question boils down to .subscribe() vs <
This sidesteps your question a bit but you may find it helpful:
I would not return a different observable stream from the one that calls the http service because doing so makes it impossible for the calling function to:
Instead I'd do:
auth.servive.ts
logout() : Observable {
return this.http.get(...).map(this.extractData)
.catch(this.handleError);
}
Now the calling code can do whatever it wants with the resulting url
logout.component.ts
logout(){
this.authService.logout().subscribe(
url => window.location.href = url,
err => {
/*todo: handle if error was thrown by authService.handleError*/
}
);
}