소스 검색

logout

develop
Robin Thoni 8 년 전
부모
커밋
926e4902e6
2개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 9
    2
      public/app/controllers/toolbar.controller.js
  2. 1
    1
      public/app/views/toolbar.html

+ 9
- 2
public/app/controllers/toolbar.controller.js 파일 보기

@@ -3,8 +3,8 @@
3 3
  */
4 4
 
5 5
 angular.module('app')
6
-    .controller('ToolBarController', ['$scope', '$state', '$mdSidenav', 'luticateAuthCache',
7
-        function($scope, $state, $mdSidenav, luticateAuthCache) {
6
+    .controller('ToolBarController', ['$scope', '$state', '$mdSidenav', 'luticateAuthCache', 'luticateAuthUsers',
7
+        function($scope, $state, $mdSidenav, luticateAuthCache, luticateAuthUsers) {
8 8
 
9 9
                 $scope.toggleSideBar = function()
10 10
                 {
@@ -18,4 +18,11 @@ angular.module('app')
18 18
                 $scope.isLogged = function () {
19 19
                         return $scope.getCurrentUser() != null;
20 20
                 };
21
+
22
+                $scope.logout = function () {
23
+                        luticateAuthUsers.logout().then(function(data)
24
+                        {
25
+                                $state.go("home");
26
+                        });
27
+                }
21 28
         }]);

+ 1
- 1
public/app/views/toolbar.html 파일 보기

@@ -9,6 +9,6 @@
9 9
             <span><a ui-sref="signUp">Sign up</a></span> or
10 10
             <span><a ui-sref="login">Login</a></span>
11 11
         </div>
12
-        <span ng-show="isLogged()"><a ui-sref="login">{{ getCurrentUser().Firstname }} {{ getCurrentUser().Lastname }}</a></span>
12
+        <span ng-show="isLogged()"><a ng-click="logout()" href="">{{ getCurrentUser().Firstname }} {{ getCurrentUser().Lastname }}</a></span>
13 13
     </div>
14 14
 </md-toolbar>

Loading…
취소
저장