@feardread/feature-factory 5.1.1 → 5.1.2

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.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Library to interact with redux toolkit and reduce boilerplate / repeated code",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -274,6 +274,7 @@ export const addHandlers = (builder, asyncActions, entity) => {
274
274
  lastRun: new Date().toISOString(),
275
275
  };
276
276
  }
277
+ console.log('pending state = ', state);
277
278
  })
278
279
  .addCase(action.fulfilled, (state, actionPayload) => {
279
280
  state.loading = false;
@@ -282,10 +283,11 @@ export const addHandlers = (builder, asyncActions, entity) => {
282
283
 
283
284
  // Handle different response structures
284
285
  const payload = actionPayload.payload;
285
- console.log('payload = ', payload);
286
+ console.log('fulfilled state = ', state);
287
+ console.log('loading state = false (success)', payload);
286
288
  // Update data based on operation type
287
289
  if (key === 'fetch' || key === 'search') {
288
- state.data = Array.isArray(payload) ? payload : (payload?.data.result || []);
290
+ state.data = Array.isArray(payload) ? payload : (payload?.data || []);
289
291
  } else if (key === 'fetchOne') {
290
292
  state[entity] = Array.isArray(payload) ? payload[0] : payload;
291
293
  } else if (key === 'create') {
@@ -326,6 +328,7 @@ export const addHandlers = (builder, asyncActions, entity) => {
326
328
  lastRun: new Date().toISOString(),
327
329
  };
328
330
  }
331
+ console.log('fully fulfilled state :: ', state);
329
332
  })
330
333
  .addCase(action.rejected, (state, actionPayload) => {
331
334
  state.loading = false;
@@ -341,6 +344,7 @@ export const addHandlers = (builder, asyncActions, entity) => {
341
344
  lastRun: new Date().toISOString(),
342
345
  };
343
346
  }
347
+ console.log('Rejected state = ', state);
344
348
  });
345
349
  });
346
350
  };