@feardread/feature-factory 5.0.6 → 5.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feardread/feature-factory",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
4
4
  "description": "Library to interact with redux toolkit and reduce boilerplate / repeated code",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -6,39 +6,39 @@ import CacheFactory from './cache';
6
6
  * Environment-based configuration
7
7
  */
8
8
  const CONFIG = {
9
+ BASE_URL: null,
9
10
  // API Base URLs
10
11
  baseUrls: {
11
12
  production: process.env.REACT_APP_API_BASE_URL_PROD || 'http://fear.master.com/fear/api/',
12
13
  development: process.env.REACT_APP_API_BASE_URL_DEV || 'http://localhost:4000/fear/api/',
13
14
  test: process.env.REACT_APP_API_BASE_URL_TEST || 'http://localhost:3001/fear/api/',
14
15
  },
15
-
16
- // Token configuration
17
16
  tokenNames: {
18
17
  bearer: 'Authorization',
19
18
  custom: process.env.REACT_APP_JWT_TOKEN_HEADER || 'x-token',
20
19
  },
21
-
22
- // Cache keys
23
20
  cacheKeys: {
24
21
  auth: 'auth',
25
22
  refreshToken: 'refresh_token',
26
23
  userPrefs: 'user_preferences',
27
24
  },
28
-
29
- // Request configuration
30
25
  timeout: parseInt(process.env.REACT_APP_API_TIMEOUT) || 30000,
31
26
  retryAttempts: parseInt(process.env.REACT_APP_API_RETRY_ATTEMPTS) || 3,
32
27
  retryDelay: parseInt(process.env.REACT_APP_API_RETRY_DELAY) || 1000,
33
28
  };
34
29
 
30
+ const setBaseUrl = (uri) => {
31
+ CONFIG.BASE_URL = uri || CONFIG.baseUrls['development'];
32
+ getBaseUrl();
33
+ };
35
34
  /**
36
35
  * Gets the appropriate base URL for the current environment
37
36
  * @returns {string} Base URL
38
37
  */
39
38
  const getBaseUrl = () => {
40
- const env = 'production'; //process.env.NODE_ENV || 'development';
41
- return CONFIG.baseUrls[env] || CONFIG.baseUrls.development;
39
+ const env = process.env.NODE_ENV || 'development';
40
+ if (!CONFIG.BASE_URL) CONFIG.BASE_URL = CONFIG.baseUrls[env] || CONFIG.baseUrls.development
41
+ return CONFIG.BASE_URL;
42
42
  };
43
43
 
44
44
  /**
@@ -525,6 +525,7 @@ const API = {
525
525
  // Configuration access
526
526
  config: CONFIG,
527
527
  getBaseUrl,
528
+ setBaseUrl
528
529
  };
529
530
 
530
531
  // Add event listener for auth failures (optional)
@@ -176,7 +176,6 @@ export function FeatureFactory(entity, reducers = {}, endpoints = null) {
176
176
  manager: createReducerManager,
177
177
  inject: mergeObjects,
178
178
  create: createFactorySlice,
179
-
180
179
  // Utility methods
181
180
  getEntityName: () => entity,
182
181
  getAdapter: () => adapter,