Unauthorized intercepter for Angular
In his article on Medium, Ryan Chenkie suggests using the following code to intercept 401 responses:
There is a problem with this approach, and it can be found in the use of the Rx operator do(). The observable chain will continue after the error handler in the second argument of do(). The error response may bubble to a generic error handler or to a service or component. In our case this prevented a redirect to the login page.
I suggest the following improvement, replacing do() with catch():