react-js-plugins 3.7.0 → 3.9.0
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.
|
@@ -32,7 +32,10 @@ interface AxiosConfigProps {
|
|
|
32
32
|
}) => any;
|
|
33
33
|
defaultHeaders?: Record<string, string>;
|
|
34
34
|
onError?: (error: AxiosError) => void;
|
|
35
|
-
onLoaderChange?: (
|
|
35
|
+
onLoaderChange?: (params: {
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
config?: AxiosRequestConfig;
|
|
38
|
+
}) => void;
|
|
36
39
|
}
|
|
37
40
|
export declare const createAxiosInstance: ({ baseURL, timeout, withCredentials, enableDateTransform, enablePrivateMode, enableLoader, getToken, handleAuthError, transformRequest, transformResponse, defaultHeaders, onError, onLoaderChange, }: AxiosConfigProps) => AxiosInstance;
|
|
38
41
|
export {};
|
|
@@ -98,7 +98,7 @@ export var createAxiosInstance = function (_a) {
|
|
|
98
98
|
_d.trys.push([0, 5, , 6]);
|
|
99
99
|
isLoaderEnabled = config.enableLoader !== undefined ? config.enableLoader : enableLoader;
|
|
100
100
|
if (isLoaderEnabled && typeof onLoaderChange === 'function') {
|
|
101
|
-
onLoaderChange(true, config);
|
|
101
|
+
onLoaderChange({ isLoading: true, config: config });
|
|
102
102
|
}
|
|
103
103
|
if ((_b = config.enablePrivateMode) !== null && _b !== void 0 ? _b : enablePrivateMode) {
|
|
104
104
|
token = getToken === null || getToken === void 0 ? void 0 : getToken();
|
|
@@ -128,7 +128,7 @@ export var createAxiosInstance = function (_a) {
|
|
|
128
128
|
error_1 = _d.sent();
|
|
129
129
|
console.error('❌ Request Interceptor Error:', error_1);
|
|
130
130
|
if (typeof onLoaderChange === 'function') {
|
|
131
|
-
onLoaderChange(false, config);
|
|
131
|
+
onLoaderChange({ isLoading: false, config: config });
|
|
132
132
|
}
|
|
133
133
|
return [2 /*return*/, Promise.reject(error_1)];
|
|
134
134
|
case 6: return [2 /*return*/];
|
|
@@ -149,7 +149,7 @@ export var createAxiosInstance = function (_a) {
|
|
|
149
149
|
? response.config.enableLoader
|
|
150
150
|
: enableLoader;
|
|
151
151
|
if (isLoaderEnabled && typeof onLoaderChange === 'function') {
|
|
152
|
-
onLoaderChange(false, response.config);
|
|
152
|
+
onLoaderChange({ isLoading: false, config: response.config });
|
|
153
153
|
}
|
|
154
154
|
if (!(typeof transformResponse === 'function')) return [3 /*break*/, 4];
|
|
155
155
|
result = transformResponse({
|
|
@@ -176,7 +176,7 @@ export var createAxiosInstance = function (_a) {
|
|
|
176
176
|
console.error('❌ Response Transform Error:', error_2);
|
|
177
177
|
isLoaderEnabled = ((_c = response === null || response === void 0 ? void 0 : response.config) === null || _c === void 0 ? void 0 : _c.enableLoader) !== undefined ? response.config.enableLoader : enableLoader;
|
|
178
178
|
if (isLoaderEnabled && typeof onLoaderChange === 'function') {
|
|
179
|
-
onLoaderChange(false, response.config);
|
|
179
|
+
onLoaderChange({ isLoading: false, config: response.config });
|
|
180
180
|
}
|
|
181
181
|
return [2 /*return*/, Promise.reject(error_2)];
|
|
182
182
|
case 6: return [2 /*return*/];
|
|
@@ -191,7 +191,7 @@ export var createAxiosInstance = function (_a) {
|
|
|
191
191
|
config = err.config;
|
|
192
192
|
isLoaderEnabled = (config === null || config === void 0 ? void 0 : config.enableLoader) !== undefined ? config.enableLoader : enableLoader;
|
|
193
193
|
if (isLoaderEnabled && typeof onLoaderChange === 'function') {
|
|
194
|
-
onLoaderChange(false, config);
|
|
194
|
+
onLoaderChange({ isLoading: false, config: config });
|
|
195
195
|
}
|
|
196
196
|
if (typeof onError === 'function') {
|
|
197
197
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-js-plugins",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|