Я пытаюсь проверить устройство в сети, прежде чем вызывать API в следующем методе
1. If connectivity call api.
2. If no connectivity just show alert.
может кто-нибудь помочь здесь
getArea() {
this.loading = this.loadingCtrl.create({
content: "loading..."
});
this.loading.present();
this.userID = "jmzw";
return this.http
.post(OMWConstants._postsURL + "Areas", 'userID="' + this.userID + '"', {
headers: this.getPostAPIHeader()
}
).toPromise().then(data => {
this.saveArea(data);
this.loading.dismiss();
return data;
}).catch(error => {
this.loading.dismiss();
this.handleError(error);
});
}