redux-clerk2 2.0.18 → 2.0.21
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/lib/actions/BaseAction.js +11 -10
- package/package.json +1 -1
- package/src/actions/BaseAction.js +10 -9
|
@@ -111,6 +111,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
111
111
|
dispatch(action);
|
|
112
112
|
|
|
113
113
|
if (type === 'success' && actionData.options.normalizeResponse) {
|
|
114
|
+
console.log('actionData.options:', actionData.options);
|
|
114
115
|
// DISPATCH RELATED ACTIONS IF WE HAVE normalizationSettings
|
|
115
116
|
if (responseData) {
|
|
116
117
|
if (actionData.normalizationSettings && Array.isArray(actionData.normalizationSettings)) {
|
|
@@ -119,7 +120,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
119
120
|
//console.log(`entity:`, entity);
|
|
120
121
|
if (!(0, _is.isObject)(entity)) {
|
|
121
122
|
var entityActionResponseData = _this._processResponse(entity, responseData);
|
|
122
|
-
entityActionResponseData.length && _this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
123
|
+
entityActionResponseData.length && _this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
123
124
|
} else {
|
|
124
125
|
var _iteratorNormalCompletion = true;
|
|
125
126
|
var _didIteratorError = false;
|
|
@@ -132,11 +133,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
132
133
|
inner_entities = _step$value[1];
|
|
133
134
|
|
|
134
135
|
var entityActionResponseData = _this._processResponse(inner_entity, responseData);
|
|
135
|
-
entityActionResponseData.length && _this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
136
|
+
entityActionResponseData.length && _this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
136
137
|
|
|
137
138
|
inner_entities.map(async function (_entity) {
|
|
138
139
|
var innerEntityActionResponseData = _this._processResponse(_entity, entityActionResponseData);
|
|
139
|
-
innerEntityActionResponseData.length && _this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch);
|
|
140
|
+
innerEntityActionResponseData.length && _this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch, actionData.options);
|
|
140
141
|
});
|
|
141
142
|
};
|
|
142
143
|
|
|
@@ -171,7 +172,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
171
172
|
//const entityActionResponseData = this._processResponse(entity, responseData);
|
|
172
173
|
|
|
173
174
|
if (updateData[entity] && updateData[entity].length) {
|
|
174
|
-
_this._dispatchRelatedAction(entity, type, actionData.instance, updateData[entity], dispatch);
|
|
175
|
+
_this._dispatchRelatedAction(entity, type, actionData.instance, updateData[entity], dispatch, actionData.options);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
//entityActionResponseData.length && this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
@@ -187,11 +188,11 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
187
188
|
inner_entities = _step2$value[1];
|
|
188
189
|
|
|
189
190
|
var entityActionResponseData = _this._processResponse(inner_entity, responseData);
|
|
190
|
-
entityActionResponseData.length && _this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
191
|
+
entityActionResponseData.length && _this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
191
192
|
|
|
192
193
|
inner_entities.map(async function (_entity) {
|
|
193
194
|
var innerEntityActionResponseData = _this._processResponse(_entity, entityActionResponseData);
|
|
194
|
-
innerEntityActionResponseData.length && _this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch);
|
|
195
|
+
innerEntityActionResponseData.length && _this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch, actionData.options);
|
|
195
196
|
});
|
|
196
197
|
};
|
|
197
198
|
|
|
@@ -221,19 +222,19 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
221
222
|
// Check for additionalData: { deleted: [] }
|
|
222
223
|
/*if(type === 'success' && additionalData.deleted && additionalData.deleted.length){
|
|
223
224
|
console.log(`additionalData:`, additionalData);
|
|
224
|
-
this._dispatchRelatedAction(this.actionNames[type], type, actionData.instance, additionalData.deleted, dispatch, 'remove');
|
|
225
|
+
this._dispatchRelatedAction(this.actionNames[type], type, actionData.instance, additionalData.deleted, dispatch, options, 'remove');
|
|
225
226
|
}*/
|
|
226
227
|
};
|
|
227
228
|
|
|
228
|
-
this._dispatchRelatedAction = function (entity, type, instance, responseData, dispatch) {
|
|
229
|
-
var actionType = arguments.length >
|
|
229
|
+
this._dispatchRelatedAction = function (entity, type, instance, responseData, dispatch, options) {
|
|
230
|
+
var actionType = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'fetch';
|
|
230
231
|
|
|
231
232
|
|
|
232
233
|
//console.log(`this.config:`, this.config);
|
|
233
234
|
|
|
234
235
|
var entityActionData = {
|
|
235
236
|
instance: instance || entity, uidField: 'id', options: {
|
|
236
|
-
appendResponse:
|
|
237
|
+
appendResponse: options && options.appendResponse !== undefined ? options.appendResponse : true,
|
|
237
238
|
recalcTotal: true
|
|
238
239
|
}
|
|
239
240
|
};
|
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ class BaseAction {
|
|
|
60
60
|
dispatch(action);
|
|
61
61
|
|
|
62
62
|
if (type === 'success' && actionData.options.normalizeResponse) {
|
|
63
|
+
//console.log(`actionData.options:`, actionData.options)
|
|
63
64
|
// DISPATCH RELATED ACTIONS IF WE HAVE normalizationSettings
|
|
64
65
|
if (responseData) {
|
|
65
66
|
if(actionData.normalizationSettings && Array.isArray(actionData.normalizationSettings)){
|
|
@@ -68,16 +69,16 @@ class BaseAction {
|
|
|
68
69
|
//console.log(`entity:`, entity);
|
|
69
70
|
if(!isObject(entity)){
|
|
70
71
|
const entityActionResponseData = this._processResponse(entity, responseData);
|
|
71
|
-
entityActionResponseData.length && this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
72
|
+
entityActionResponseData.length && this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
72
73
|
}else{
|
|
73
74
|
|
|
74
75
|
for (let [inner_entity, inner_entities] of Object.entries(entity)) {
|
|
75
76
|
const entityActionResponseData = this._processResponse(inner_entity, responseData);
|
|
76
|
-
entityActionResponseData.length && this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
77
|
+
entityActionResponseData.length && this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
77
78
|
|
|
78
79
|
inner_entities.map(async (_entity) => {
|
|
79
80
|
const innerEntityActionResponseData = this._processResponse(_entity, entityActionResponseData);
|
|
80
|
-
innerEntityActionResponseData.length && this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch);
|
|
81
|
+
innerEntityActionResponseData.length && this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch, actionData.options);
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
}
|
|
@@ -97,7 +98,7 @@ class BaseAction {
|
|
|
97
98
|
//const entityActionResponseData = this._processResponse(entity, responseData);
|
|
98
99
|
|
|
99
100
|
if(updateData[entity] && updateData[entity].length){
|
|
100
|
-
this._dispatchRelatedAction(entity, type, actionData.instance, updateData[entity], dispatch);
|
|
101
|
+
this._dispatchRelatedAction(entity, type, actionData.instance, updateData[entity], dispatch, actionData.options);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
//entityActionResponseData.length && this._dispatchRelatedAction(entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
@@ -105,11 +106,11 @@ class BaseAction {
|
|
|
105
106
|
|
|
106
107
|
for (let [inner_entity, inner_entities] of Object.entries(entity)) {
|
|
107
108
|
const entityActionResponseData = this._processResponse(inner_entity, responseData);
|
|
108
|
-
entityActionResponseData.length && this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch);
|
|
109
|
+
entityActionResponseData.length && this._dispatchRelatedAction(inner_entity, type, actionData.instance, entityActionResponseData, dispatch, actionData.options);
|
|
109
110
|
|
|
110
111
|
inner_entities.map(async (_entity) => {
|
|
111
112
|
const innerEntityActionResponseData = this._processResponse(_entity, entityActionResponseData);
|
|
112
|
-
innerEntityActionResponseData.length && this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch);
|
|
113
|
+
innerEntityActionResponseData.length && this._dispatchRelatedAction(_entity, type, actionData.instance, innerEntityActionResponseData, dispatch, actionData.options);
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
}
|
|
@@ -124,18 +125,18 @@ class BaseAction {
|
|
|
124
125
|
// Check for additionalData: { deleted: [] }
|
|
125
126
|
/*if(type === 'success' && additionalData.deleted && additionalData.deleted.length){
|
|
126
127
|
console.log(`additionalData:`, additionalData);
|
|
127
|
-
this._dispatchRelatedAction(this.actionNames[type], type, actionData.instance, additionalData.deleted, dispatch, 'remove');
|
|
128
|
+
this._dispatchRelatedAction(this.actionNames[type], type, actionData.instance, additionalData.deleted, dispatch, options, 'remove');
|
|
128
129
|
}*/
|
|
129
130
|
|
|
130
131
|
};
|
|
131
132
|
|
|
132
|
-
_dispatchRelatedAction = (entity, type, instance, responseData, dispatch, actionType = 'fetch') => {
|
|
133
|
+
_dispatchRelatedAction = (entity, type, instance, responseData, dispatch, options, actionType = 'fetch') => {
|
|
133
134
|
|
|
134
135
|
//console.log(`this.config:`, this.config);
|
|
135
136
|
|
|
136
137
|
const entityActionData = {
|
|
137
138
|
instance: instance || entity, uidField: 'id', options: {
|
|
138
|
-
appendResponse:
|
|
139
|
+
appendResponse: options && options.appendResponse !== undefined ? options.appendResponse : true,
|
|
139
140
|
recalcTotal: true
|
|
140
141
|
}
|
|
141
142
|
};
|