@docbrasil/api-systemmanager 1.1.45 → 1.1.46
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 +3 -3
- package/dist/bundle.cjs +3 -3
- package/dist/bundle.mjs +1 -1
- package/package.json +1 -1
package/api/dispatch.js
CHANGED
|
@@ -18,7 +18,7 @@ class Dispatch {
|
|
|
18
18
|
// Add request interceptor for offline handling
|
|
19
19
|
self._client.interceptors.request.use(
|
|
20
20
|
async (config) => {
|
|
21
|
-
if (self._isOnline()) {
|
|
21
|
+
if (self._isOnline() || !self._cache) {
|
|
22
22
|
return config;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -55,7 +55,7 @@ class Dispatch {
|
|
|
55
55
|
self._client.interceptors.response.use(
|
|
56
56
|
async response => {
|
|
57
57
|
// Cache successful responses when online
|
|
58
|
-
if (response.status === 200 && self._isOnline()) {
|
|
58
|
+
if (response.status === 200 && self._isOnline() && self._cache) {
|
|
59
59
|
await self._setCache(response.config.url, {
|
|
60
60
|
method: response.config.method,
|
|
61
61
|
data: response.config.data,
|
|
@@ -110,7 +110,7 @@ class Dispatch {
|
|
|
110
110
|
* @private
|
|
111
111
|
*/
|
|
112
112
|
_isOnline() {
|
|
113
|
-
return typeof navigator !== 'undefined' && navigator.onLine
|
|
113
|
+
return typeof navigator !== 'undefined' && navigator.onLine;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
package/dist/bundle.cjs
CHANGED
|
@@ -30,7 +30,7 @@ class Dispatch {
|
|
|
30
30
|
// Add request interceptor for offline handling
|
|
31
31
|
self._client.interceptors.request.use(
|
|
32
32
|
async (config) => {
|
|
33
|
-
if (self._isOnline()) {
|
|
33
|
+
if (self._isOnline() || !self._cache) {
|
|
34
34
|
return config;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -67,7 +67,7 @@ class Dispatch {
|
|
|
67
67
|
self._client.interceptors.response.use(
|
|
68
68
|
async response => {
|
|
69
69
|
// Cache successful responses when online
|
|
70
|
-
if (response.status === 200 && self._isOnline()) {
|
|
70
|
+
if (response.status === 200 && self._isOnline() && self._cache) {
|
|
71
71
|
await self._setCache(response.config.url, {
|
|
72
72
|
method: response.config.method,
|
|
73
73
|
data: response.config.data,
|
|
@@ -122,7 +122,7 @@ class Dispatch {
|
|
|
122
122
|
* @private
|
|
123
123
|
*/
|
|
124
124
|
_isOnline() {
|
|
125
|
-
return typeof navigator !== 'undefined' && navigator.onLine
|
|
125
|
+
return typeof navigator !== 'undefined' && navigator.onLine;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|