mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 00:57:44 +01:00
Fixed redirection when deleted user.
This commit is contained in:
parent
60ae6fba1b
commit
debf482765
@ -20,9 +20,9 @@
|
||||
.module('harbor.session')
|
||||
.controller('CurrentUserController', CurrentUserController);
|
||||
|
||||
CurrentUserController.$inject = ['$scope', 'CurrentUserService', 'currentUser', '$window', '$document'];
|
||||
CurrentUserController.$inject = ['$scope', 'CurrentUserService', 'currentUser', '$window', '$document', 'LogOutService'];
|
||||
|
||||
function CurrentUserController($scope, CurrentUserService, currentUser, $window, $document) {
|
||||
function CurrentUserController($scope, CurrentUserService, currentUser, $window, $document, LogOutService) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
|
||||
function getCurrentUserComplete(response) {
|
||||
if(angular.isDefined(response)) {
|
||||
currentUser.set(response.data);
|
||||
if(location.pathname === '/') {
|
||||
currentUser.set(response.data);
|
||||
if(location.pathname === '/') {
|
||||
$window.location.href = '/dashboard';
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,18 @@
|
||||
|
||||
function getCurrentUserFailed(e){
|
||||
console.log('No session of current user.');
|
||||
LogOutService()
|
||||
.success(logOutSuccess)
|
||||
.error(logOutFailed);
|
||||
}
|
||||
|
||||
function logOutSuccess(data, status) {
|
||||
currentUser.unset();
|
||||
}
|
||||
|
||||
function logOutFailed(data, status) {
|
||||
console.log('Failed to log out:' + data);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user