primary_care_admin_binder 0.1.182 → 0.1.183

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.
Files changed (2) hide show
  1. package/dist/index.cjs.js +39 -5
  2. package/package.json +1 -1
package/dist/index.cjs.js CHANGED
@@ -12692,10 +12692,15 @@ var queries$n = {
12692
12692
  }, doc)];
12693
12693
  },
12694
12694
  locationtree: function locationtree() {
12695
+ var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
12696
+ var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
12695
12697
  return {
12696
12698
  appcode: dbName,
12697
12699
  requestid: "24f4da82-c4ae-40a4-b894-f7cf9dd398d1",
12698
- filter: {}
12700
+ filter: {
12701
+ offset: offset,
12702
+ limit: limit
12703
+ }
12699
12704
  };
12700
12705
  }
12701
12706
  };
@@ -13043,24 +13048,32 @@ var LOCATION_MASTER_INSERT = createAsyncThunk("locationApiSlice/locationinsert",
13043
13048
  }, _callee3, null, [[1, 3]]);
13044
13049
  })));
13045
13050
  var LOCATION_TREE_READ = createAsyncThunk("locationApiSlice/locationtree", /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
13046
- var _ref8,
13051
+ var payload,
13052
+ _ref8,
13047
13053
  rejectWithValue,
13054
+ _payload$offset,
13055
+ offset,
13056
+ _payload$limit,
13057
+ limit,
13048
13058
  data,
13049
13059
  _args4 = arguments,
13050
13060
  _t4;
13051
13061
  return _regenerator().w(function (_context4) {
13052
13062
  while (1) switch (_context4.p = _context4.n) {
13053
13063
  case 0:
13064
+ payload = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
13054
13065
  _ref8 = _args4.length > 1 ? _args4[1] : undefined, rejectWithValue = _ref8.rejectWithValue;
13055
13066
  _context4.p = 1;
13067
+ _payload$offset = payload.offset, offset = _payload$offset === void 0 ? 0 : _payload$offset, _payload$limit = payload.limit, limit = _payload$limit === void 0 ? 50 : _payload$limit;
13056
13068
  _context4.n = 2;
13057
13069
  return fetchData({
13058
- body: JSON.stringify(queries$n.locationtree())
13070
+ body: JSON.stringify(queries$n.locationtree(offset, limit))
13059
13071
  }, __baseUrl__$1);
13060
13072
  case 2:
13061
13073
  data = _context4.v;
13062
13074
  return _context4.a(2, _objectSpread2(_objectSpread2({}, defaultState.List), {}, {
13063
- data: data
13075
+ data: data,
13076
+ offset: offset
13064
13077
  }));
13065
13078
  case 3:
13066
13079
  _context4.p = 3;
@@ -13100,7 +13113,28 @@ var locationSlice = createSlice({
13100
13113
  builder.addCase(LOCATION_TREE_READ.fulfilled, function (state, action) {
13101
13114
  state.location_tree.loading = false;
13102
13115
  state.location_tree.error = false;
13103
- state.location_tree = action.payload;
13116
+ var isLoadMore = action.payload.offset > 0;
13117
+ if (isLoadMore) {
13118
+ var currentData = state.location_tree.data || [];
13119
+ var newData = action.payload.data || [];
13120
+ var mergedData = _toConsumableArray(currentData);
13121
+ newData.forEach(function (newOrgObj) {
13122
+ var orgName = Object.keys(newOrgObj)[0];
13123
+ var existingOrgIndex = mergedData.findIndex(function (org) {
13124
+ return Object.keys(org)[0] === orgName;
13125
+ });
13126
+ if (existingOrgIndex !== -1) {
13127
+ mergedData[existingOrgIndex][orgName] = [].concat(_toConsumableArray(mergedData[existingOrgIndex][orgName]), _toConsumableArray(newOrgObj[orgName]));
13128
+ } else {
13129
+ mergedData.push(newOrgObj);
13130
+ }
13131
+ });
13132
+ state.location_tree = _objectSpread2(_objectSpread2({}, action.payload), {}, {
13133
+ data: mergedData
13134
+ });
13135
+ } else {
13136
+ state.location_tree = action.payload;
13137
+ }
13104
13138
  });
13105
13139
  builder.addCase(LOCATION_TREE_READ.pending, function (state) {
13106
13140
  state.location_tree.loading = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primary_care_admin_binder",
3
- "version": "0.1.182",
3
+ "version": "0.1.183",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",