|
3 | 3 |
|
4 | 4 | angular.module('tc.services').factory('TcAuthService', TcAuthService);
|
5 | 5 |
|
6 |
| - TcAuthService.$inject = ['CONSTANTS', 'auth', 'AuthTokenService', '$rootScope', '$q', '$log', '$timeout', 'UserService', 'Helpers', 'ApiService', 'store']; |
| 6 | + TcAuthService.$inject = ['CONSTANTS', 'auth', 'AuthTokenService', '$rootScope', '$q', '$log', '$timeout', 'UserService', 'Helpers', 'ApiService', 'store', '$http']; |
7 | 7 |
|
8 |
| - function TcAuthService(CONSTANTS, auth, AuthTokenService, $rootScope, $q, $log, $timeout, UserService, Helpers, ApiService, store) { |
| 8 | + function TcAuthService(CONSTANTS, auth, AuthTokenService, $rootScope, $q, $log, $timeout, UserService, Helpers, ApiService, store, $http) { |
9 | 9 | $log = $log.getInstance("TcAuthServicetcAuth");
|
10 | 10 | var auth0 = auth;
|
| 11 | + var apiUrl = CONSTANTS.API_URL_V3; |
11 | 12 | var service = {
|
12 | 13 | login: login,
|
13 | 14 | socialLogin: socialLogin,
|
|
162 | 163 | }
|
163 | 164 |
|
164 | 165 | function logout() {
|
| 166 | + $http({ |
| 167 | + url: apiUrl + '/authorizations/1', |
| 168 | + method: 'DELETE', |
| 169 | + headers: { |
| 170 | + 'Authorization': "Bearer " + AuthTokenService.getV3Token() |
| 171 | + } |
| 172 | + }).then(function(res) { |
| 173 | + $log.log('logout successful'); |
| 174 | + }).catch(function(resp) { |
| 175 | + $log.error('logout error'); |
| 176 | + }); |
| 177 | + |
165 | 178 | return $q(function(resolve, reject) {
|
166 | 179 | AuthTokenService.removeTokens();
|
167 | 180 | $rootScope.$broadcast(CONSTANTS.EVENT_USER_LOGGED_OUT);
|
|
0 commit comments