Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create an http interceptor that handles a 302 redirect to the login page when automatically logged out
- $httpProvider.interceptors.push(function($q, $location){
- return {
- 'response': function(response) {
- if(response.data.indexOf('<title>Login</title>') != -1)
- {
- $location.url('/logout'); //problem: this redirects to 'http://host/myApp/#/logout, not 'http://host/logout'
- }
- return response || $q.when(response);
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement