Skip to content

Commit

Permalink
#1402 Fix 401 error handling in router
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 23, 2020
1 parent 899884f commit f7379bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,5 +617,12 @@ angular.module('thehive', [
$rootScope.title = toState.title;
}
});

$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){
if(error && error.status && error.status === 401) {
event.preventDefault();
$state.go('login');
}
});
})
.constant('UrlParser', url);

0 comments on commit f7379bf

Please sign in to comment.