X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-demo.git;a=blobdiff_plain;f=afm-client%2Fapp%2FFrontend%2Fwidgets%2FNotifications%2FTokenRefreshSvc.js;h=a7ee13fe4c7cf1fa43044861bbd0dcd07d210651;hp=5c5b5ae867e666e16600d49bfcce078008522741;hb=a79d1fc845f31cda41b55b0ffb9aa807732bbcd0;hpb=eac68b18429b5e8bfb2aa8823d4f9a93f4e2ef5d diff --git a/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js b/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js index 5c5b5ae..a7ee13f 100644 --- a/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js +++ b/afm-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js @@ -37,21 +37,22 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) .directive ('tokenRefresh', function($timeout, $http, $location, Notification, AppConfig) { function mymethods(scope, elem, attrs) { - scope.status=undefined; // neither thu neither false - - + scope.logged=undefined; // neither thu neither false + scope.online = function () { elem.addClass ("online"); elem.removeClass ("offline"); + scope.logged=true; }; scope.offline = function(){ elem.addClass ("offline"); elem.removeClass ("online"); + scope.logged=false; }; scope.onerror = function(data, errcode, headers) { - if (scope.status !== false) { + if (scope.logged !== false) { Notification.warning ({message: "AppFramework Binder Lost", delay: 5000}); scope.offline(); } @@ -59,7 +60,7 @@ angular.module('TokenRefresh', ['AppConfig', 'ModalNotification']) }; scope.onsuccess = function(data, errcode, headers, config) { - if (scope.status !== true) { + if (scope.logged !== true) { if (data.request.token) AppConfig.session.token = data.request.token; if (data.request.uuid) AppConfig.session.uuid = data.request.uuid; if (data.request.timeout) AppConfig.session.timeout = data.request.timeout;