How to loop through HttpInterceptor (interceptAfter) for response in angular 2

This is my current interceptor for the response, I do not want this method to be called after receiving a response from a specific request -

public interceptAfter(response: InterceptedResponse): InterceptedResponse {
        if(response.response.status == 0){
            // CORS error
            location.href="/abc/assets/sessionTimeoutError.html";
        }
        else if(response.response.status == 302 || response.response.status==401){
            if(response.response.url && response.response.url.indexOf('/xyz/')==-1){
                location.href="/abc/assets/sessionTimeoutError.html";
            }
        }
        return response;
    }

      

+3


source to share





All Articles