eleven-solutions-common-website-unique-web 19.0.15 → 19.0.17
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.
@@ -183,9 +183,22 @@ const TaxonomyForm = ({ url }) => {
|
|
183
183
|
setNewValue(item.value);
|
184
184
|
setIsModalOpen(true);
|
185
185
|
};
|
186
|
+
// const handleEditClick = (index: number, id: string) => {
|
187
|
+
// setIsAddingSubType(false);
|
188
|
+
// const item = similarTaxonomies[index];
|
189
|
+
// setSelectedTaxonomyId(id);
|
190
|
+
// setEditTaxonomyItem(item);
|
191
|
+
// setNewCode(item.code);
|
192
|
+
// setNewValue(item.value);
|
193
|
+
// setIsModalOpen(true);
|
194
|
+
// };
|
186
195
|
const handleEditClick = (index, id) => {
|
187
196
|
setIsAddingSubType(false);
|
188
|
-
const item = similarTaxonomies
|
197
|
+
const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
|
198
|
+
if (!item) {
|
199
|
+
console.error("Taxonomy not found");
|
200
|
+
return;
|
201
|
+
}
|
189
202
|
setSelectedTaxonomyId(id);
|
190
203
|
setEditTaxonomyItem(item);
|
191
204
|
setNewCode(item.code);
|
@@ -279,10 +292,9 @@ const TaxonomyForm = ({ url }) => {
|
|
279
292
|
try {
|
280
293
|
yield addTaxonomyApi(url, type, Number(newCode), newValue);
|
281
294
|
alert("Value added successfully");
|
282
|
-
const
|
283
|
-
|
284
|
-
|
285
|
-
}
|
295
|
+
const response = yield fetchTaxonomiessApi(url);
|
296
|
+
const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
|
297
|
+
setSimilarTaxonomies(filteredTaxonomies);
|
286
298
|
}
|
287
299
|
catch (error) {
|
288
300
|
console.error("Error adding value:", error);
|
package/package.json
CHANGED
@@ -233,12 +233,28 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
233
233
|
setIsModalOpen(true);
|
234
234
|
};
|
235
235
|
|
236
|
+
// const handleEditClick = (index: number, id: string) => {
|
237
|
+
// setIsAddingSubType(false);
|
238
|
+
|
239
|
+
// const item = similarTaxonomies[index];
|
240
|
+
// setSelectedTaxonomyId(id);
|
241
|
+
|
242
|
+
// setEditTaxonomyItem(item);
|
243
|
+
// setNewCode(item.code);
|
244
|
+
// setNewValue(item.value);
|
245
|
+
// setIsModalOpen(true);
|
246
|
+
// };
|
236
247
|
const handleEditClick = (index: number, id: string) => {
|
237
248
|
setIsAddingSubType(false);
|
238
249
|
|
239
|
-
const item = similarTaxonomies
|
240
|
-
setSelectedTaxonomyId(id);
|
250
|
+
const item = similarTaxonomies.find((taxonomy) => taxonomy.id === id);
|
241
251
|
|
252
|
+
if (!item) {
|
253
|
+
console.error("Taxonomy not found");
|
254
|
+
return;
|
255
|
+
}
|
256
|
+
|
257
|
+
setSelectedTaxonomyId(id);
|
242
258
|
setEditTaxonomyItem(item);
|
243
259
|
setNewCode(item.code);
|
244
260
|
setNewValue(item.value);
|
@@ -365,10 +381,11 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
|
|
365
381
|
await addTaxonomyApi(url, type, Number(newCode), newValue);
|
366
382
|
|
367
383
|
alert("Value added successfully");
|
368
|
-
const
|
369
|
-
|
370
|
-
|
371
|
-
|
384
|
+
const response = await fetchTaxonomiessApi(url);
|
385
|
+
const filteredTaxonomies = (response as { type: string }[]).filter(
|
386
|
+
(taxonomy: { type: string }) => taxonomy.type === type
|
387
|
+
);
|
388
|
+
setSimilarTaxonomies(filteredTaxonomies);
|
372
389
|
} catch (error) {
|
373
390
|
console.error("Error adding value:", error);
|
374
391
|
}
|