X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=afb-client%2Fapp%2FFrontend%2Fwidgets%2FNotifications%2FTokenRefreshSvc.js;h=0d1cf3840f70e38dcca942541a71ed11044f0f68;hb=4136c1506e0c894e604ec069339313987a7e05e7;hp=16717482e05ad5ba5fd6d99463d6d803818f9c63;hpb=fbdd26b4a4aa8eb3d83333fe44e93590bc174e11;p=src%2Fapp-framework-demo.git diff --git a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js index 1671748..0d1cf38 100644 --- a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js +++ b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js @@ -25,21 +25,20 @@ 'use strict'; var template = - '
' - + 'afb://{{hostname}}:{{httpdport}}' - + '' - + '
' - ; + '
' + + 'afb://{{hostname}}:{{httpdport}}' + + '' + + '
'; // scope module is load statically before any route is cativated -angular.module('TokenRefresh', []) +angular.module('TokenRefresh', ['ConfigApp', 'ModalNotification']) .directive ('tokenRefresh', function($timeout, $http, $location, Notification, ConfigApp) { function mymethods(scope, elem, attrs) { - scope.status; + scope.status=false; scope.online = function () { elem.addClass ("online"); @@ -54,10 +53,10 @@ angular.module('TokenRefresh', []) // Check Binder status scope.getping = function() { - var handler = $http.get(ConfigApp.api.ping+'xx?token='+ ConfigApp.session.token); + var handler = $http.post(ConfigApp.session.ping+'?token='+ ConfigApp.session.token); handler.success(function(response, errcode, headers, config) { if (!scope.status) { - Notification.success ({message: "AFB Back to Live", delay: 3000}); + Notification.success ({message: "AppFramework Binder Back to Live", delay: 3000}); scope.online(); } scope.status = 1; @@ -65,7 +64,7 @@ angular.module('TokenRefresh', []) handler.error(function(response, errcode, headers) { if (scope.status) { - Notification.warning ({message: "AFB Lost", delay: 5000}); + Notification.warning ({message: "AppFramework Binder Lost", delay: 5000}); scope.offline(); } scope.status = 0; @@ -77,8 +76,8 @@ angular.module('TokenRefresh', []) // Check Binder status scope.refresh = function() { - var handler = $http.get(ConfigApp.api.refresh+'?token='+ ConfigApp.session.token); - $timeout (scope.refresh, ConfigApp.session.timeout *800); + var handler = $http.post(ConfigApp.session.refresh+'?token='+ ConfigApp.session.token); + $timeout (scope.refresh, ConfigApp.session.timeout *250); }; scope.icon = attrs.icon || "fi-lightbulb";