Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70433

Redirect to LoginPage when HttpStatusCode is 404

$
0
0

@mdline wrote:

Hello,

I wrote my own HttpRequestDispatcher to handle globally errors.

  post(url: string, body: any, options?: RequestOptionsArgs): Observable<Response> {
    return this.http.post(url, body, options).map(this.handleResult)
     .catch(this.handleError);
  }

private handleError(error: any) {
  if(error.status === 404){
_this.navCtrl.push(LoginPage);
    }
    return Observable.throw('Error occured');
  }

But is it the proper way to make Observable.throw(‘Error occured’); in case of 404.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70433

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>