# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1562072097 -19800
#      Tue Jul 02 18:24:57 2019 +0530
# Node ID a913fd46c404ad0bc4fe7c9f3fa97aa55748af7b
# Parent  1108be9558de913ab5f4ed4d15e50604d7545d49
Related to issue 40946 : Added errroCallback for findSubscriptions function

diff -r 1108be9558de -r a913fd46c404 web/org.openbravo.retail.loyalty.programs/js/component/subscription-buttons.js
--- a/web/org.openbravo.retail.loyalty.programs/js/component/subscription-buttons.js	Wed Jun 12 10:12:24 2019 +0200
+++ b/web/org.openbravo.retail.loyalty.programs/js/component/subscription-buttons.js	Tue Jul 02 18:24:57 2019 +0530
@@ -41,6 +41,11 @@
           });
         }
       });
+    }, function () {
+      callback({
+        count: 0,
+        summary: ''
+      });
     });
   } else {
     callback({
diff -r 1108be9558de -r a913fd46c404 web/org.openbravo.retail.loyalty.programs/js/component/subscription-icon.js
--- a/web/org.openbravo.retail.loyalty.programs/js/component/subscription-icon.js	Wed Jun 12 10:12:24 2019 +0200
+++ b/web/org.openbravo.retail.loyalty.programs/js/component/subscription-icon.js	Tue Jul 02 18:24:57 2019 +0530
@@ -33,10 +33,12 @@
     });
 
     callback(activeSubscriptions);
+  }, function () {
+    callback([]);
   });
 };
 
-OBRLP.findSubscriptions = function (bpId, loyaltyProgramIds, callback) {
+OBRLP.findSubscriptions = function (bpId, loyaltyProgramIds, callback, errroCallback) {
   // 1 - get all loyalty programs
   var programs = OB.MobileApp.model.get('obrlpProgram');
   if (!programs || !programs.length) {
@@ -84,6 +86,8 @@
 
   }, function (e) {
     OB.error('Unexpected error getting OBRLP_LoyaltySubscriptions.', e);
+    errroCallback();
+    return;
   });
 };
 
