From 23719d94411c4d59357ecd37bbc9a8c79a7e5c5c Mon Sep 17 00:00:00 2001
From: Mike Rylander <mrylander@gmail.com>
Date: Fri, 4 May 2018 09:58:53 -0400
Subject: [PATCH] LP#1755220: Return value checking in offline session fetch

We need to make sure that we receive the correct shape of data (array) rather
than that we simply got anything when fetching sessions.  In the case of an
expired session token, we'll receive an ILS Event object informing us of the
expiration where we'd normally see a list of sessions.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dawn Dale <ddale@georgialibraries.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
---
 Open-ILS/web/js/ui/default/staff/offline.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js
index 1441c3884a..947aa42858 100644
--- a/Open-ILS/web/js/ui/default/staff/offline.js
+++ b/Open-ILS/web/js/ui/default/staff/offline.js
@@ -126,10 +126,11 @@ function($routeProvider , $locationProvider , $compileProvider) {
             });
         }
 
+        $scope.sessions = [];
         $scope.refreshSessions = function () {
 
             return $http.get(formURL({action:'status',status_type:'sessions'})).then(function(res) {
-                if (res.data) {
+                if (angular.isArray(res.data)) {
                     $scope.sessions = res.data;
                     return $q.when();
                 }
-- 
2.11.0