@visns-studio/visns-components 3.4.0 → 3.4.2

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.
@@ -621,7 +621,31 @@ function Form({
621
621
  }
622
622
  }
623
623
 
624
- const res = await CustomFetch(url, method, formData);
624
+ const fieldMap = formSettings.fields.reduce((acc, field) => {
625
+ acc[field.id] = field;
626
+ return acc;
627
+ }, {});
628
+
629
+ let payload = { ...formData };
630
+
631
+ Object.keys(formData).forEach((key) => {
632
+ const value = formData[key];
633
+ const field = fieldMap[key];
634
+
635
+ // Check if the field exists and is of type 'multi-dropdown-ajax'
636
+ if (field && field.type === 'multi-dropdown-ajax') {
637
+ // Check if 'value' and 'label' exist
638
+ if (value && 'value' in value && 'label' in value) {
639
+ console.info(
640
+ `Updating payload for key ${key}:`,
641
+ value
642
+ );
643
+ payload[key] = value.value;
644
+ }
645
+ }
646
+ });
647
+
648
+ const res = await CustomFetch(url, method, payload);
625
649
 
626
650
  if (res.data.error === '') {
627
651
  if (fetchTable) {
@@ -657,8 +681,9 @@ function Form({
657
681
  ) {
658
682
  if (formSettings.save.return.type === 'table') {
659
683
  if (
684
+ result &&
660
685
  result[formSettings.save.return.param].length >
661
- 0
686
+ 0
662
687
  ) {
663
688
  const td = parseTableData(
664
689
  result[formSettings.save.return.param]
package/package.json CHANGED
@@ -49,7 +49,7 @@
49
49
  "react-dom": "^17.0.1"
50
50
  },
51
51
  "name": "@visns-studio/visns-components",
52
- "version": "3.4.0",
52
+ "version": "3.4.2",
53
53
  "description": "Various packages to assist in the development of our Custom Applications.",
54
54
  "main": "index.js",
55
55
  "scripts": {