JAVA-67: renamed spring-security-angular to spring-security-web-angular
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('app')
|
||||
.controller('HomeController', HomeController);
|
||||
|
||||
HomeController.$inject = ['$window', '$http', '$scope'];
|
||||
function HomeController($window, $http, $scope) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = null;
|
||||
|
||||
initController();
|
||||
|
||||
function initController() {
|
||||
|
||||
$http({
|
||||
url: 'http://localhost:8082/user',
|
||||
method: "GET"
|
||||
}).then(function (response) {
|
||||
vm.user = response.data.name;
|
||||
},function(error){
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.logout = function(){
|
||||
$window.sessionStorage.setItem('userData', '');
|
||||
$http.defaults.headers.common['Authorization'] = 'Basic';
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,3 @@
|
||||
<h1>Hi {{vm.user}}!</h1>
|
||||
<p>You're logged in!!</p>
|
||||
<p><a href="#!/login" class="btn btn-primary" ng-click="logout()">Logout</a></p>
|
||||
Reference in New Issue
Block a user