Added Logout Function
This commit is contained in:
parent
f87a14b2da
commit
3465ff3465
1 changed files with 79 additions and 71 deletions
|
@ -1,5 +1,7 @@
|
||||||
angular.module('SeHub')
|
angular.module('SeHub')
|
||||||
.controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$location', function($scope, $rootScope, apiService, $cookies, $location) {
|
.controller('mainController', ['$scope', '$rootScope', 'apiService', '$cookies', '$cookieStore', '$location', '$window',
|
||||||
|
|
||||||
|
function($scope, $rootScope, apiService, $cookies, $cookieStore, $location, $window) {
|
||||||
|
|
||||||
var token = $cookies['com.sehub.www'];
|
var token = $cookies['com.sehub.www'];
|
||||||
|
|
||||||
|
@ -25,8 +27,8 @@ angular.module('SeHub')
|
||||||
})
|
})
|
||||||
|
|
||||||
$scope.menuItems = [{
|
$scope.menuItems = [{
|
||||||
"title": "Home",
|
"title": "Dash Board",
|
||||||
"icon": "fa fa-home",
|
"icon": "fa fa-tachometer",
|
||||||
"style": "selected",
|
"style": "selected",
|
||||||
"route": "/home"
|
"route": "/home"
|
||||||
}, {
|
}, {
|
||||||
|
@ -61,13 +63,18 @@ angular.module('SeHub')
|
||||||
"route": "/logout"
|
"route": "/logout"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
$scope.menuClicked = function(item){
|
$scope.menuClicked = function(item) {
|
||||||
var route = ""
|
var route = ""
|
||||||
|
if (item.title == "Log Out") {
|
||||||
|
console.info('Logging Out!');
|
||||||
|
$cookieStore.remove('com.sehub.www');
|
||||||
|
$window.location.href = 'http://se-hub.appspot.com'; // Reference to 'welcome' page
|
||||||
|
}
|
||||||
for (var i = $scope.menuItems.length - 1; i >= 0; i--) {
|
for (var i = $scope.menuItems.length - 1; i >= 0; i--) {
|
||||||
if($scope.menuItems[i].title === item.title){
|
if ($scope.menuItems[i].title === item.title) {
|
||||||
$scope.menuItems[i].style="selected";
|
$scope.menuItems[i].style = "selected";
|
||||||
route = $scope.menuItems[i].route;
|
route = $scope.menuItems[i].route;
|
||||||
}else{
|
} else {
|
||||||
$scope.menuItems[i].style = "";
|
$scope.menuItems[i].style = "";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -75,4 +82,5 @@ angular.module('SeHub')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}
|
||||||
|
]);
|
Loading…
Reference in a new issue