mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-08 07:51:25 +01:00
32 lines
802 B
JavaScript
32 lines
802 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.session')
|
|
.controller('CurrentUserController', CurrentUserController)
|
|
|
|
CurrentUserController.$inject = ['CurrentUserService', 'currentUser', '$scope', '$timeout'];
|
|
|
|
function CurrentUserController(CurrentUserService, currentUser, $scope, $timeout) {
|
|
|
|
var vm = this;
|
|
|
|
CurrentUserService()
|
|
.then(getCurrentUserComplete)
|
|
.catch(getCurrentUserFailed);
|
|
|
|
function getCurrentUserComplete(response) {
|
|
console.log('Successful logged in.');
|
|
$timeout(function(){
|
|
$scope.$broadcast('currentUser', response.data);
|
|
currentUser.set(response.data);
|
|
}, 50);
|
|
}
|
|
|
|
function getCurrentUserFailed(e){
|
|
console.log('Have not logged in yet.');
|
|
}
|
|
}
|
|
|
|
})(); |