In my current setup using Ionic 2 with Angular 2, I have the following method implementation:
private login(params: any, url: string){
var p = new Promise<JsonResult>((resolve, reject) => {
let body = JSON.stringify(params);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
this.http.post(url, body, options)
.timeout(10000, new Error('Timeout exceeded during login'))
.subscribe((res) => {
let json = new JsonResult().deserialize(res.json());
resolve(json);
}, (err) => {
reject(err);
});
});
return p;
}
Despite my efforts, it seems that the subscribe function is not behaving as expected. The error handler does not trigger, even after the timeout limit has been surpassed.
I'm wondering if this issue is a common one or if there might be an error in my code structure?
Any assistance on this matter would be highly valued.