From 3aacb7170593b626ef376a3b4659e0fe46a08877 Mon Sep 17 00:00:00 2001 From: Klaus Klein Date: Thu, 27 Apr 2017 10:43:21 -0300 Subject: [PATCH] Remove unnecessary console.log --- .../imports/startup/client/auth.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-html5/imports/startup/client/auth.js b/bigbluebutton-html5/imports/startup/client/auth.js index f5fa2d56c6..a51f79914e 100644 --- a/bigbluebutton-html5/imports/startup/client/auth.js +++ b/bigbluebutton-html5/imports/startup/client/auth.js @@ -1,5 +1,8 @@ import Auth from '/imports/ui/services/auth'; +// disconnected and trying to open a new connection +const STATUS_CONNECTING = 'connecting'; + export function joinRouteHandler(nextState, replace, callback) { if (!nextState || !nextState.params.authToken) { replace({ pathname: '/error/404' }); @@ -46,18 +49,13 @@ function _addReconnectObservable() { let lastStatus = null; Tracker.autorun(() => { - console.log("Meteor status", Meteor.status()); - console.log("lastStatus status", lastStatus); - if (shouldAuthenticate(Meteor.status(),lastStatus)) { - console.log("Autenticando..."); + lastStatus = updateStatus(Meteor.status(), lastStatus); + + if (shouldAuthenticate(Meteor.status(), lastStatus)) { Auth.authenticate(true); lastStatus = Meteor.status().status; } - - if (shouldUpateStatus(Meteor.status(), lastStatus)) { - lastStatus = Meteor.status().status; - } }); } @@ -66,8 +64,8 @@ function _addReconnectObservable() { * @param {Object} status * @param {String} lastStatus */ -export function shouldAuthenticate(status, lastStatus){ - return lastStatus != null && lastStatus === "connecting" && status.connected; +export function shouldAuthenticate(status, lastStatus) { + return lastStatus != null && lastStatus === STATUS_CONNECTING && status.connected; } /** @@ -75,6 +73,6 @@ export function shouldAuthenticate(status, lastStatus){ * @param {Object} status * @param {string} lastStatus */ -export function shouldUpateStatus(status, lastStatus) { - return status.retryCount > 0 && lastStatus !== "connecting"; +export function updateStatus(status, lastStatus) { + return status.retryCount > 0 && lastStatus !== STATUS_CONNECTING ? status.status : lastStatus; }