fetchStepData(): Observable<JSON> {
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json; charset=utf-8');
let options = new RequestOptions({
method: RequestMethod.Post,
url: "FeedbackMaster.aspx/fetchStepData",
headers: this.headers,
body:{log:this.login}
});
return this._http.request(new Request(options)).retry(2)
.map((response: Response)=>this.retrieveData(response))
.do(data => {this.temp=data, console.log('fetchStepData:'+ JSON.stringify(JSON.parse(this.temp.d)))})
.catch(this.handleError);
}
retrieveData(res: Response) {
let data = res.json();
return data || { }; //<--- not wrapped with data
}
handleError(error: any) {
console.error('An error occurred', error);
return Promise.reject(error.message || error);
}
.......................................................................................................
Error
[ts]
Type 'Observable<void>' is not assignable to type 'Observable<JSON>'.
Type 'void' is not assignable to type 'JSON'.
What could be the issue in my code?