0

I am developing Angular 2 application, and I have HTTP interceptor already created in application. In some cases, I want to return from interceptor, for example I do not want to make some calls to server if user is not authorized. I just want to stop request by returning the right Observable so that the other requests may proceed and application does not break. I have tried to create some Empty Observable but it breaks my app. Basically, I would like to create null object-like behavior. Could someone help me?

get(url: string, options?: RequestOptionsArgs): Observable<Response> {
    if(!isAuthorized()) {
       //here a I want to create return value that will stop request 
       //but app will continue to run on the same page
    }
}

0 Answers0