From 1e4c404d3a0657840acdf143e27fdc6ede6f81b5 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 20 May 2019 10:43:02 -0400 Subject: #817 construct API url after we login so we get tokens --- www/js/MenuController.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'www/js') diff --git a/www/js/MenuController.js b/www/js/MenuController.js index bf4e4a6a..e81e9e82 100644 --- a/www/js/MenuController.js +++ b/www/js/MenuController.js @@ -50,7 +50,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io $rootScope.alarmCount = 0; $rootScope.isAlarm = false; $rootScope.authSession = ''; - + //console.log ("******************* AUTHSESSION RESET!!!!!!"); @@ -99,7 +99,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io cordova.plugin.http.setSSLCertMode('nocheck', function () { NVR.debug('--> SSL is permissive, will allow any certs. Use at your own risk.'); }, function () { - console.log('-->Error setting SSL permissive'); + NVR.log('-->Error setting SSL permissive'); }); if ($rootScope.platformOS == 'android') { @@ -134,7 +134,8 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io } - var apiurl = loginData.apiurl + '/host/getVersion.json'+$rootScope.authSession; + + //var portalurl = loginData.url + '/index.php'; zmAutoLogin.doLogin("") @@ -149,6 +150,11 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io // possible image digits changed between servers NVR.getKeyConfigParams(0); $rootScope.runMode = NVR.getBandwidth(); + //console.log ("HERE"); + var apiurl = loginData.apiurl + '/host/getVersion.json?'+$rootScope.authSession; + + //console.log ("****** MENU CONTROLLER:"+apiurl); + NVR.log("Validating APIs at " + apiurl); $http.get(apiurl) .then(function (data) { @@ -185,7 +191,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io disableBack: true }); - console.log("+++ state go after getMonitors force"); + //console.log("+++ state go after getMonitors force"); $state.go('app.refresh', { "view": $state.current.name }); @@ -197,7 +203,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io function (error) { var refresh = NVR.getMonitors(1) .then(function () { - console.log("+++ state go after API version error: " + error); + //console.log("+++ state go after API version error: " + error); $rootScope.apiVersion = "0.0.0"; NVR.debug("Error, failed API version, setting to " + $rootScope.apiVersion); @@ -238,7 +244,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io disableBack: true }); - console.log("+++ state go after 5xx"); + //console.log("+++ state go after 5xx"); $state.go('app.refresh', { "view": $state.current.name }); @@ -254,7 +260,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io $ionicHistory.nextViewOptions({ disableBack: true }); - console.log("+++ state go after API version force"); + //console.log("+++ state go after API version force"); $state.go('app.refresh', { "view": $state.current.name }); -- cgit v1.2.3