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')
|
||||
.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'];
|
||||
|
||||
|
@ -25,8 +27,8 @@ angular.module('SeHub')
|
|||
})
|
||||
|
||||
$scope.menuItems = [{
|
||||
"title": "Home",
|
||||
"icon": "fa fa-home",
|
||||
"title": "Dash Board",
|
||||
"icon": "fa fa-tachometer",
|
||||
"style": "selected",
|
||||
"route": "/home"
|
||||
}, {
|
||||
|
@ -61,13 +63,18 @@ angular.module('SeHub')
|
|||
"route": "/logout"
|
||||
}];
|
||||
|
||||
$scope.menuClicked = function(item){
|
||||
$scope.menuClicked = function(item) {
|
||||
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--) {
|
||||
if($scope.menuItems[i].title === item.title){
|
||||
$scope.menuItems[i].style="selected";
|
||||
if ($scope.menuItems[i].title === item.title) {
|
||||
$scope.menuItems[i].style = "selected";
|
||||
route = $scope.menuItems[i].route;
|
||||
}else{
|
||||
} else {
|
||||
$scope.menuItems[i].style = "";
|
||||
}
|
||||
};
|
||||
|
@ -75,4 +82,5 @@ angular.module('SeHub')
|
|||
}
|
||||
|
||||
|
||||
}]);
|
||||
}
|
||||
]);
|
Loading…
Reference in a new issue