- .directive ('tokenRefresh', function($timeout, $http, $location, Notification, ConfigApp) {
+ .directive ('tokenRefresh', function($timeout, $http, $location, Notification, AppConfig) {
scope.online = function () {
elem.addClass ("online");
elem.removeClass ("offline");
scope.online = function () {
elem.addClass ("online");
elem.removeClass ("offline");
};
scope.offline = function(){
elem.addClass ("offline");
elem.removeClass ("online");
};
scope.offline = function(){
elem.addClass ("offline");
elem.removeClass ("online");
};
scope.onsuccess = function(data, errcode, headers, config) {
};
scope.onsuccess = function(data, errcode, headers, config) {
- if (scope.status !== true) {
- if (data.request.token) ConfigApp.session.token = data.request.token;
- if (data.request.uuid) ConfigApp.session.uuid = data.request.uuid;
- if (data.request.timeout) ConfigApp.session.timeout = data.request.timeout;
-
+ 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;
+ if (scope.logged !== true) {
// process success and error
handler.success(scope.onsuccess);
handler.error(scope.onerror);
// restart a new timer for next ping
// process success and error
handler.success(scope.onsuccess);
handler.error(scope.onerror);
// restart a new timer for next ping
// process success and error
handler.success(scope.onsuccess);
handler.error(scope.onerror);
// restart a new timer for next refresh to 1/4 of timeout session
// process success and error
handler.success(scope.onsuccess);
handler.error(scope.onerror);
// restart a new timer for next refresh to 1/4 of timeout session
- $timeout (scope.getping, ConfigApp.session.pingrate*1000);
- $timeout (scope.refresh, ConfigApp.session.timeout *250);
+ $timeout (scope.getping, AppConfig.session.pingrate*1000);
+ $timeout (scope.refresh, AppConfig.session.timeout *250);