contentoh-components-library 21.1.96 → 21.1.97
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.
|
@@ -162,24 +162,31 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
162
162
|
|
|
163
163
|
case "orderImages":
|
|
164
164
|
{
|
|
165
|
-
var _inputsByRetailer$act;
|
|
166
|
-
|
|
167
165
|
var _inputsByRetailer = state.inputsByRetailer,
|
|
168
166
|
valuesInitial = state.valuesInitial,
|
|
169
167
|
inputsInitial = state.inputsInitial,
|
|
170
168
|
inputs = state.inputs;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
var _inputsByRetailer$act;
|
|
172
|
+
|
|
173
|
+
var orderedImages = [];
|
|
174
|
+
var imageIdArray = [];
|
|
175
|
+
if (!_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
|
|
176
|
+
action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
|
|
177
|
+
imageIdArray.push(input.id_image);
|
|
178
|
+
valuesInitial.forEach(function (value) {
|
|
179
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
180
|
+
});
|
|
181
|
+
}));
|
|
182
|
+
inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
|
|
183
|
+
return imageIdArray.includes(input.id);
|
|
177
184
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
185
|
+
values = orderedImages.length > 0 ? orderedImages : [];
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.log(error);
|
|
188
|
+
}
|
|
189
|
+
|
|
183
190
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
184
191
|
values: values,
|
|
185
192
|
inputs: inputs
|
package/package.json
CHANGED
|
@@ -83,21 +83,27 @@ const reducerImages = (state, action) => {
|
|
|
83
83
|
return { ...state, values };
|
|
84
84
|
case "orderImages": {
|
|
85
85
|
let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
inputsByRetailer[action.retailerId]
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
try {
|
|
87
|
+
const orderedImages = [];
|
|
88
|
+
const imageIdArray = [];
|
|
89
|
+
if (!inputsByRetailer[action.retailerId])
|
|
90
|
+
inputsByRetailer[action.retailerId] = [];
|
|
91
|
+
action.retailerId &&
|
|
92
|
+
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
93
|
+
imageIdArray.push(input.id_image);
|
|
94
|
+
valuesInitial.forEach((value) => {
|
|
95
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
96
|
+
});
|
|
93
97
|
});
|
|
94
|
-
});
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
inputs = inputsInitial?.filter((input) =>
|
|
100
|
+
imageIdArray.includes(input.id)
|
|
101
|
+
);
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
values = orderedImages.length > 0 ? orderedImages : [];
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log(error);
|
|
106
|
+
}
|
|
101
107
|
return { ...state, values, inputs };
|
|
102
108
|
}
|
|
103
109
|
default:
|