react-js-plugins 3.4.0 → 3.5.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.
package/README.md CHANGED
@@ -34,11 +34,10 @@ It supports automatic date formatting, optional data encryption/decryption, seam
34
34
 
35
35
  ```ts
36
36
  const apiPrivate = createAxiosInstance({
37
- baseURL: getEnv('VITE_API_BASE_URL'),
37
+ baseURL: 'https://jsonplaceholder.typicode.com',
38
38
  timeout: 30000,
39
39
  withCredentials: true,
40
40
  enableDateTransform: true,
41
- enableEncryptDecrypt: true,
42
41
  transformRequest: (data) => transform(data),
43
42
  transformResponse: (data) => transform(data),
44
43
  handleAuthError: async (instance, originalRequest, error) => {
@@ -90,6 +90,7 @@ export var createAxiosInstance = function (_a) {
90
90
  });
91
91
  axiosInstance.defaults.headers.common = __assign(__assign({}, axiosInstance.defaults.headers.common), defaultHeaders);
92
92
  axiosInstance.interceptors.request.use(function (config) {
93
+ var _a;
93
94
  try {
94
95
  if (enablePrivateMode || config.enablePrivateMode) {
95
96
  var token = getToken === null || getToken === void 0 ? void 0 : getToken();
@@ -102,7 +103,7 @@ export var createAxiosInstance = function (_a) {
102
103
  }
103
104
  if (config === null || config === void 0 ? void 0 : config.data) {
104
105
  var transformed = typeof transformRequest === 'function'
105
- ? transformRequest(config.data)
106
+ ? (_a = transformRequest(config)) !== null && _a !== void 0 ? _a : config.data
106
107
  : config.data;
107
108
  config.data = transformed;
108
109
  }
@@ -117,14 +118,14 @@ export var createAxiosInstance = function (_a) {
117
118
  return Promise.reject(error);
118
119
  });
119
120
  axiosInstance.interceptors.response.use(function (response) {
120
- var _a;
121
+ var _a, _b;
121
122
  try {
122
123
  if (((_a = response.config) === null || _a === void 0 ? void 0 : _a.responseType) === 'blob') {
123
124
  return response;
124
125
  }
125
126
  if (response === null || response === void 0 ? void 0 : response.data) {
126
127
  var transformed = typeof transformResponse === 'function'
127
- ? transformResponse(response.data)
128
+ ? (_b = transformResponse(response)) !== null && _b !== void 0 ? _b : response.data
128
129
  : response.data;
129
130
  response.data = transformed;
130
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-js-plugins",
3
- "version": "3.4.0",
3
+ "version": "3.5.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",