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