summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-08-27 13:54:44 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-08-27 13:54:44 -0400
commit67852d2827aedce0e06c9dbee1cba7ad5b59c412 (patch)
tree59e64ff20d7b058b5c0e6332b1bd4dd37ba72e9b /www
parente097d31f6188cdd41fe4cf08ea7ee6d27576d71f (diff)
checking if API works
Diffstat (limited to 'www')
-rw-r--r--www/js/LoginCtrl.js24
1 files changed, 19 insertions, 5 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index efaa08e7..d1130bd3 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -155,17 +155,31 @@ function addhttp(url) {
// fail in app.js that will be called to show an error
// box
- // Note that API auth ties into ZM Auth, so in one fell
- // swoop we've just validated both. Happy?
.then( function(data)
{
- //console.log ("THE DATA WAS " + data);
- //console.log ("SHOWING POPUP ");
- $ionicPopup.alert({
+ // Now let's validate if the API works
+ // https://github.com/pliablepixels/zmNinja/issues/25
+ ZMDataModel.zmLog ("Validating APIs at " + apiurl);
+ $http.get(apiurl)
+ .success (function (data) {
+ $ionicPopup.alert({
title: 'Login validated',
template: 'Please explore the menu and enjoy zmNinja!'
}).then(function(res) { $ionicSideMenuDelegate.toggleLeft();});
+
+ })
+ .error (function (error) {
+ ZMDataModel.displayBanner ('error',['ZoneMinder API check failed', 'Please check API settings']);
+ ZMDataModel.zmLog ("API login error " + JSON.stringify(error));
+ $ionicPopup.alert({
+ title: 'Login validated but API failed',
+ template: 'Please check your API settings'
+ });
+ });
+
+
+
});
};