Currently, I am utilizing the Angular 4 http client to fetch data from the server, but I am encountering an error that states:
Type 'Observable<Observable<Object>>' is not assignable to type
'Observable<boolean>'.
Within the http request, my code looks like this:
saveCredit(data): Observable<boolean> {
return this._http.post(this.authurl + 'auth/save-credit', data)
.map((res) => {
return Observable.of(res);
}, (err) => {
return Observable.of(false)
});
}
After saving on the server, I am returning either true or false. What additional steps should I take in order to effectively utilize the above method using:
this._acceeService.saveCredit(data).subscribe((res)=>{
...do my stuff here
})