@docbrasil/api-systemmanager 1.1.49 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/dispatch.js CHANGED
@@ -11,9 +11,9 @@ class Dispatch {
11
11
  Joi.assert(options.parent, Joi.object().required());
12
12
 
13
13
  const self = this;
14
+ self._cache = options.parent.options.cache;
15
+ self._forceCache = options.parent.options.forceCache;
14
16
  self.parent = options.parent;
15
- self._cache = self.parent.options.cache;
16
- self._forceCache = self.parent.options.forceCache;
17
17
  self._client = Axios.create({baseURL: self.parent.options.uri, withCredentials: true});
18
18
 
19
19
  // Add request interceptor for offline handling
@@ -47,6 +47,7 @@ class Dispatch {
47
47
  };
48
48
  }
49
49
 
50
+ self.errorOffline();
50
51
  throw new Error('Network error: No internet connection and no cached data available');
51
52
  },
52
53
  error => Promise.reject(error)
@@ -147,6 +148,10 @@ class Dispatch {
147
148
  }
148
149
  }
149
150
 
151
+ errorOffline() {
152
+ this._cache.errorOffline();
153
+ }
154
+
150
155
  /**
151
156
  * Get the URL context
152
157
  * @param url {string} Full url
package/dist/bundle.cjs CHANGED
@@ -23,9 +23,9 @@ class Dispatch {
23
23
  Joi__default["default"].assert(options.parent, Joi__default["default"].object().required());
24
24
 
25
25
  const self = this;
26
+ self._cache = options.parent.options.cache;
27
+ self._forceCache = options.parent.options.forceCache;
26
28
  self.parent = options.parent;
27
- self._cache = self.parent.options.cache;
28
- self._forceCache = self.parent.options.forceCache;
29
29
  self._client = Axios__default["default"].create({baseURL: self.parent.options.uri, withCredentials: true});
30
30
 
31
31
  // Add request interceptor for offline handling
@@ -59,6 +59,7 @@ class Dispatch {
59
59
  };
60
60
  }
61
61
 
62
+ self.errorOffline();
62
63
  throw new Error('Network error: No internet connection and no cached data available');
63
64
  },
64
65
  error => Promise.reject(error)
@@ -159,6 +160,10 @@ class Dispatch {
159
160
  }
160
161
  }
161
162
 
163
+ errorOffline() {
164
+ this._cache.errorOffline();
165
+ }
166
+
162
167
  /**
163
168
  * Get the URL context
164
169
  * @param url {string} Full url